runbooks 0.6.1__py3-none-any.whl → 0.7.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- jupyter-agent/.env +2 -0
- jupyter-agent/.gradio/certificate.pem +31 -0
- jupyter-agent/__main__.log +8 -0
- jupyter-agent/tmp/4ojbs8a02ir/jupyter-agent.ipynb +68 -0
- jupyter-agent/tmp/cm5iasgpm3p/jupyter-agent.ipynb +91 -0
- jupyter-agent/tmp/crqbsseag5/jupyter-agent.ipynb +91 -0
- jupyter-agent/tmp/hohanq1u097/jupyter-agent.ipynb +57 -0
- jupyter-agent/tmp/jns1sam29wm/jupyter-agent.ipynb +53 -0
- jupyter-agent/tmp/jupyter-agent.ipynb +27 -0
- runbooks/__init__.py +87 -37
- runbooks/cfat/README.md +300 -49
- runbooks/cfat/__init__.py +2 -2
- runbooks/finops/README.md +337 -0
- runbooks/finops/__init__.py +2 -4
- runbooks/finops/cli.py +1 -1
- runbooks/inventory/aws_organization.png +0 -0
- runbooks/inventory/collectors/__init__.py +8 -0
- runbooks/inventory/collectors/aws_management.py +791 -0
- runbooks/inventory/collectors/aws_networking.py +3 -3
- runbooks/main.py +3416 -590
- runbooks/operate/__init__.py +207 -0
- runbooks/operate/base.py +311 -0
- runbooks/operate/cloudformation_operations.py +619 -0
- runbooks/operate/cloudwatch_operations.py +496 -0
- runbooks/operate/dynamodb_operations.py +812 -0
- runbooks/operate/ec2_operations.py +926 -0
- runbooks/operate/iam_operations.py +569 -0
- runbooks/operate/s3_operations.py +1211 -0
- runbooks/operate/tagging_operations.py +655 -0
- runbooks/remediation/CLAUDE.md +100 -0
- runbooks/remediation/DOME9.md +218 -0
- runbooks/remediation/README.md +26 -0
- runbooks/remediation/Tests/update_policy.py +74 -0
- runbooks/remediation/__init__.py +95 -0
- runbooks/remediation/acm_cert_expired_unused.py +98 -0
- runbooks/remediation/acm_remediation.py +875 -0
- runbooks/remediation/api_gateway_list.py +167 -0
- runbooks/remediation/base.py +643 -0
- runbooks/remediation/cloudtrail_remediation.py +908 -0
- runbooks/remediation/cloudtrail_s3_modifications.py +296 -0
- runbooks/remediation/cognito_active_users.py +78 -0
- runbooks/remediation/cognito_remediation.py +856 -0
- runbooks/remediation/cognito_user_password_reset.py +163 -0
- runbooks/remediation/commons.py +455 -0
- runbooks/remediation/dynamodb_optimize.py +155 -0
- runbooks/remediation/dynamodb_remediation.py +744 -0
- runbooks/remediation/dynamodb_server_side_encryption.py +108 -0
- runbooks/remediation/ec2_public_ips.py +134 -0
- runbooks/remediation/ec2_remediation.py +892 -0
- runbooks/remediation/ec2_subnet_disable_auto_ip_assignment.py +72 -0
- runbooks/remediation/ec2_unattached_ebs_volumes.py +448 -0
- runbooks/remediation/ec2_unused_security_groups.py +202 -0
- runbooks/remediation/kms_enable_key_rotation.py +651 -0
- runbooks/remediation/kms_remediation.py +717 -0
- runbooks/remediation/lambda_list.py +243 -0
- runbooks/remediation/lambda_remediation.py +971 -0
- runbooks/remediation/multi_account.py +569 -0
- runbooks/remediation/rds_instance_list.py +199 -0
- runbooks/remediation/rds_remediation.py +873 -0
- runbooks/remediation/rds_snapshot_list.py +192 -0
- runbooks/remediation/requirements.txt +118 -0
- runbooks/remediation/s3_block_public_access.py +159 -0
- runbooks/remediation/s3_bucket_public_access.py +143 -0
- runbooks/remediation/s3_disable_static_website_hosting.py +74 -0
- runbooks/remediation/s3_downloader.py +215 -0
- runbooks/remediation/s3_enable_access_logging.py +562 -0
- runbooks/remediation/s3_encryption.py +526 -0
- runbooks/remediation/s3_force_ssl_secure_policy.py +143 -0
- runbooks/remediation/s3_list.py +141 -0
- runbooks/remediation/s3_object_search.py +201 -0
- runbooks/remediation/s3_remediation.py +816 -0
- runbooks/remediation/scan_for_phrase.py +425 -0
- runbooks/remediation/workspaces_list.py +220 -0
- runbooks/{security_baseline → security}/README.md +191 -68
- runbooks/security/__init__.py +70 -0
- runbooks/{security_baseline → security}/security_baseline_tester.py +5 -3
- runbooks-0.7.5.dist-info/METADATA +606 -0
- {runbooks-0.6.1.dist-info → runbooks-0.7.5.dist-info}/RECORD +115 -75
- {runbooks-0.6.1.dist-info → runbooks-0.7.5.dist-info}/entry_points.txt +0 -1
- runbooks/aws/__init__.py +0 -58
- runbooks/aws/dynamodb_operations.py +0 -231
- runbooks/aws/ec2_copy_image_cross-region.py +0 -195
- runbooks/aws/ec2_describe_instances.py +0 -202
- runbooks/aws/ec2_ebs_snapshots_delete.py +0 -186
- runbooks/aws/ec2_run_instances.py +0 -213
- runbooks/aws/ec2_start_stop_instances.py +0 -212
- runbooks/aws/ec2_terminate_instances.py +0 -143
- runbooks/aws/ec2_unused_eips.py +0 -196
- runbooks/aws/ec2_unused_volumes.py +0 -188
- runbooks/aws/s3_create_bucket.py +0 -142
- runbooks/aws/s3_list_buckets.py +0 -152
- runbooks/aws/s3_list_objects.py +0 -156
- runbooks/aws/s3_object_operations.py +0 -183
- runbooks/aws/tagging_lambda_handler.py +0 -183
- runbooks/inventory/cfn_move_stack_instances.py +0 -1526
- runbooks/inventory/delete_s3_buckets_objects.py +0 -169
- runbooks/inventory/lockdown_cfn_stackset_role.py +0 -224
- runbooks/inventory/update_aws_actions.py +0 -173
- runbooks/inventory/update_cfn_stacksets.py +0 -1215
- runbooks/inventory/update_cloudwatch_logs_retention_policy.py +0 -294
- runbooks/inventory/update_iam_roles_cross_accounts.py +0 -478
- runbooks/inventory/update_s3_public_access_block.py +0 -539
- runbooks/organizations/__init__.py +0 -12
- runbooks/organizations/manager.py +0 -374
- runbooks/security_baseline/requirements.txt +0 -7
- runbooks-0.6.1.dist-info/METADATA +0 -373
- /runbooks/{aws → operate}/tags.json +0 -0
- /runbooks/{security_baseline → remediation/Tests}/__init__.py +0 -0
- /runbooks/{security_baseline → security}/checklist/__init__.py +0 -0
- /runbooks/{security_baseline → security}/checklist/account_level_bucket_public_access.py +0 -0
- /runbooks/{security_baseline → security}/checklist/alternate_contacts.py +0 -0
- /runbooks/{security_baseline → security}/checklist/bucket_public_access.py +0 -0
- /runbooks/{security_baseline → security}/checklist/cloudwatch_alarm_configuration.py +0 -0
- /runbooks/{security_baseline → security}/checklist/direct_attached_policy.py +0 -0
- /runbooks/{security_baseline → security}/checklist/guardduty_enabled.py +0 -0
- /runbooks/{security_baseline → security}/checklist/iam_password_policy.py +0 -0
- /runbooks/{security_baseline → security}/checklist/iam_user_mfa.py +0 -0
- /runbooks/{security_baseline → security}/checklist/multi_region_instance_usage.py +0 -0
- /runbooks/{security_baseline → security}/checklist/multi_region_trail.py +0 -0
- /runbooks/{security_baseline → security}/checklist/root_access_key.py +0 -0
- /runbooks/{security_baseline → security}/checklist/root_mfa.py +0 -0
- /runbooks/{security_baseline → security}/checklist/root_usage.py +0 -0
- /runbooks/{security_baseline → security}/checklist/trail_enabled.py +0 -0
- /runbooks/{security_baseline → security}/checklist/trusted_advisor.py +0 -0
- /runbooks/{security_baseline → security}/config-origin.json +0 -0
- /runbooks/{security_baseline → security}/config.json +0 -0
- /runbooks/{security_baseline → security}/permission.json +0 -0
- /runbooks/{security_baseline → security}/report_generator.py +0 -0
- /runbooks/{security_baseline → security}/report_template_en.html +0 -0
- /runbooks/{security_baseline → security}/report_template_jp.html +0 -0
- /runbooks/{security_baseline → security}/report_template_kr.html +0 -0
- /runbooks/{security_baseline → security}/report_template_vn.html +0 -0
- /runbooks/{security_baseline → security}/run_script.py +0 -0
- /runbooks/{security_baseline → security}/utils/__init__.py +0 -0
- /runbooks/{security_baseline → security}/utils/common.py +0 -0
- /runbooks/{security_baseline → security}/utils/enums.py +0 -0
- /runbooks/{security_baseline → security}/utils/language.py +0 -0
- /runbooks/{security_baseline → security}/utils/level_const.py +0 -0
- /runbooks/{security_baseline → security}/utils/permission_list.py +0 -0
- {runbooks-0.6.1.dist-info → runbooks-0.7.5.dist-info}/WHEEL +0 -0
- {runbooks-0.6.1.dist-info → runbooks-0.7.5.dist-info}/licenses/LICENSE +0 -0
- {runbooks-0.6.1.dist-info → runbooks-0.7.5.dist-info}/top_level.txt +0 -0
@@ -1,7 +1,9 @@
|
|
1
1
|
conftest.py,sha256=HTnQMw9wxefkvX5q4yG8EUH2qVLJBnC9QCt3UCltw7I,586
|
2
|
+
jupyter-agent/.env,sha256=ZyIap7kKkg5_JwRCJqtoDpixqPkHU3Y2cJxYadKlO-c,103
|
2
3
|
jupyter-agent/.env.template,sha256=xU2MQ80zvx2mYr_n3alar7oop9mdhonU6xNVEQGlzwY,71
|
3
4
|
jupyter-agent/.gitattributes,sha256=Ea1--iSXXuSww8OjjtGHN_Blil91oKlnh7V2p4oCM2E,1519
|
4
5
|
jupyter-agent/README.md,sha256=WJ7zUhaFaDl26cH6mcWimqkpN04TJhIH4TKiyd6MDI0,370
|
6
|
+
jupyter-agent/__main__.log,sha256=TDRITkba40x0Lby7EkWncbIs4i8g1sztDD_heSj62aI,710
|
5
7
|
jupyter-agent/app.py,sha256=8UR8AzqrJYHWr2bpj-mOSuPHLYzd8AWVJbxnM43h5Q8,8727
|
6
8
|
jupyter-agent/cloudops-agent.png,sha256=A4e0WfpihWVHFtz0Yj09Y9uci-IWF4gdpnZifACzdT8,408376
|
7
9
|
jupyter-agent/ds-system-prompt.txt,sha256=YZydzHqxaHgXVPORiltlWDg3rK-c-a2Dlx0BAj2dfsg,5034
|
@@ -9,29 +11,20 @@ jupyter-agent/jupyter-agent.png,sha256=KJjLvoWAnuhSaEsWBW8PHwouzk2sVC84PTtSuMDEg
|
|
9
11
|
jupyter-agent/llama3_template.jinja,sha256=gywY7mJ14M-VeCSs0LLFO-Nt3S7XEJaQQ-KuzorzuEs,5198
|
10
12
|
jupyter-agent/requirements.txt,sha256=OrwjCjWcVo8lp82yY6Sor2r46mxhqMfkFiH6PBphtA0,173
|
11
13
|
jupyter-agent/utils.py,sha256=MGsDPI6a2OYc39wwSeg8oAM69U_k8mMSzegwT1cyp_0,13067
|
12
|
-
|
14
|
+
jupyter-agent/.gradio/certificate.pem,sha256=IrVXonBVszYGtlWfN3A5KNPkrXnxELQH0EmG4YQ1Q9E,1939
|
15
|
+
jupyter-agent/tmp/jupyter-agent.ipynb,sha256=jrqDAZIRUDqcCLyrV_Jb435WIipb7OB5FjxULP0mynI,612
|
16
|
+
jupyter-agent/tmp/4ojbs8a02ir/jupyter-agent.ipynb,sha256=hDZB4yLCsQcTMXMNZhNCVAmuXugTXJlXlDu-5BnNZDM,70481
|
17
|
+
jupyter-agent/tmp/cm5iasgpm3p/jupyter-agent.ipynb,sha256=KQ8slJljjsUjsE-COrh-jZFoaEg5jwP6ukk6VX6-C0I,89492
|
18
|
+
jupyter-agent/tmp/crqbsseag5/jupyter-agent.ipynb,sha256=XUM3BR1BJ8qp37rKDft-f9rXCGiG6V7_WOoF6TbBUNw,110860
|
19
|
+
jupyter-agent/tmp/hohanq1u097/jupyter-agent.ipynb,sha256=tPE_Uwx8ZQscqVaM0gfnSgsxNc9RkrcisJKICW1ah38,9686
|
20
|
+
jupyter-agent/tmp/jns1sam29wm/jupyter-agent.ipynb,sha256=7tibJV-03sU3Xn4oRjt6E2QOQIt57E0xxY0hcoNctqg,75815
|
21
|
+
runbooks/__init__.py,sha256=tjccXsn7a6V-Y3q6jaXqiQ2q8-sMdbgB1Zt4ILd6cFI,4600
|
13
22
|
runbooks/__main__.py,sha256=0hTPUA9KkLm_H_COqaIpNzXvC4Lv5b_XYYBV6fUFDrM,241
|
14
23
|
runbooks/base.py,sha256=SE31vwKB_CW2C0w2Onb7QfjU2xJXcUbiYTSHBDWT7KE,11593
|
15
24
|
runbooks/config.py,sha256=63Bct1jASQG3mjPTNnzfJwTMgXzG8aQqVsaku6ugZR0,7839
|
16
|
-
runbooks/main.py,sha256=
|
17
|
-
runbooks/
|
18
|
-
runbooks/
|
19
|
-
runbooks/aws/ec2_copy_image_cross-region.py,sha256=2Afoo2ddzswgtdhdzsDq5aZiqXkQ0_kUyRdHbhkaLAA,6017
|
20
|
-
runbooks/aws/ec2_describe_instances.py,sha256=0S9iY-J_dSOeve0HyeuVu4s01oCgPjdz3DYHhnJo-9w,6545
|
21
|
-
runbooks/aws/ec2_ebs_snapshots_delete.py,sha256=LwaGGAg_7tdqic1thBLywlHKjMSMyye2B79d4yNtK78,5886
|
22
|
-
runbooks/aws/ec2_run_instances.py,sha256=ZpqGXN2yeXz7jYwsL7EZrQsfaYxzRoH5UIrDeksmPRI,6885
|
23
|
-
runbooks/aws/ec2_start_stop_instances.py,sha256=M4adf7DZI176aWfb7oeT_pYjrs-IbZ9moGoVkIco7Fw,6035
|
24
|
-
runbooks/aws/ec2_terminate_instances.py,sha256=p8ZHHDkT--rlOFah82hG6SJpty4rYZa4hn3yq4MqvQI,4692
|
25
|
-
runbooks/aws/ec2_unused_eips.py,sha256=04pjoeSwm-CfJKT6u9XuHa_D-iK5r9D65FaisQy00Zk,5535
|
26
|
-
runbooks/aws/ec2_unused_volumes.py,sha256=ZnLr-LHVHoznmij8r2RtZ5Y3W7bBAklophnJKQmN6lg,5733
|
27
|
-
runbooks/aws/s3_create_bucket.py,sha256=UhQML3KWflvvKmEZFod4tYPzIukCGRJdmBXSfB3ne7w,4216
|
28
|
-
runbooks/aws/s3_list_buckets.py,sha256=sHh05_KrvpLzOlGZJy8nxTAfTuMaVtMIhb3A9nLh_rQ,4752
|
29
|
-
runbooks/aws/s3_list_objects.py,sha256=idwrfbjqEwF5sHFSJRhNb6X38P3tTscCwv0IwKm0NuA,4634
|
30
|
-
runbooks/aws/s3_object_operations.py,sha256=46l8v0Xt8pJhTuMjCyLDSLsU06WGxWKad99nQ91o2hg,5400
|
31
|
-
runbooks/aws/tagging_lambda_handler.py,sha256=NZwzlI3NwEKsLk3b-a_rq3EjMLQ9hUKWi_pzhomvWws,5433
|
32
|
-
runbooks/aws/tags.json,sha256=-Y77SDvrvn0sCdsxgdRwu0sl0mih2Ib_N6nGi-UtE5U,513
|
33
|
-
runbooks/cfat/README.md,sha256=ovKuVTxIJWqRmkTK1JGTNkG25Sufe918wYAFA86_SS8,4917
|
34
|
-
runbooks/cfat/__init__.py,sha256=4CAtXB-hUUgkZnp_QefbADpMAcTlXI-zDGyHgBlprAI,1876
|
25
|
+
runbooks/main.py,sha256=YOG-bPNiDYtL4XCZozGEkjyVP61GPwCZ1IbMq8mLlY4,148252
|
26
|
+
runbooks/cfat/README.md,sha256=rP_FNuKB8xKfj89dPKf43_s_-ScqrmlQ_ZPXj6h0pfo,11089
|
27
|
+
runbooks/cfat/__init__.py,sha256=Ivsd0lEZvnt0ctaRYXQSli3ZveAqrCLZNqRDOoQbr7Y,1922
|
35
28
|
runbooks/cfat/app.ts,sha256=EwpA9bQzkoH1qqTJ_Tco47PwVG2zTv4g8ZmEGYpWYlU,27785
|
36
29
|
runbooks/cfat/cli.py,sha256=37KUY-ObzMcB7xYs2R8Q40djLFnBgLhBnUXujvn2M7s,3483
|
37
30
|
runbooks/cfat/models.py,sha256=gh-7XmqEH9PvqrmxtmIhWoKGpGcFTWr1pah_9iNrLxM,37960
|
@@ -93,9 +86,10 @@ runbooks/cfat/tests/test_cli.py,sha256=6FGIKozOuZUroftmbNCVaT2YlSwStwyWu2yEBjcoH
|
|
93
86
|
runbooks/cfat/tests/test_integration.py,sha256=L4kkWW41Jsuzn4Tv-z_a5cY6xOo_aHzCAVjlmuGHuew,12281
|
94
87
|
runbooks/cfat/tests/test_models.py,sha256=16Dcdty82_yotJ2ngBbgydCy9BDamxtMZrs4a1t-mVM,18267
|
95
88
|
runbooks/cfat/tests/test_reporting.py,sha256=ysPZSAFgCQ7oIkOdBxUrlCiyZBhWDpcnp0I2cv3k9_Q,12631
|
96
|
-
runbooks/finops/
|
89
|
+
runbooks/finops/README.md,sha256=Fm9dpPujttPLJ2ES2d_zDUZ-YrVqVkeaAM1gjlcQxCw,12983
|
90
|
+
runbooks/finops/__init__.py,sha256=5yilBFwen9iRqrV0xVZCKr9WO_LjFt1lBSIJPdPvaho,2265
|
97
91
|
runbooks/finops/aws_client.py,sha256=o9ShoAH_V1QKBlq2Li4VTrjnXNj3ezgGvenJAiPUbjY,9379
|
98
|
-
runbooks/finops/cli.py,sha256=
|
92
|
+
runbooks/finops/cli.py,sha256=M1sH4RjDShMqLJDpYxnGh7CJ5fKHCApsGJ_VpWQAcMo,5227
|
99
93
|
runbooks/finops/cost_processor.py,sha256=BNyG9HpkAI27UFcoRurP3Tz1Q4BV9u_fVk6wVzf0ysU,15042
|
100
94
|
runbooks/finops/dashboard_runner.py,sha256=JDNx-MqmDuGEZXPhRTDaxlAcjzmvMpjXhOEwIkj8n2A,18281
|
101
95
|
runbooks/finops/helpers.py,sha256=TlFXLZ7oJViYlKWk7MpbWDVlG71jM8C61dM8r5yjNMw,12805
|
@@ -111,12 +105,11 @@ runbooks/inventory/__init__.py,sha256=J-MoV_B5ScwlqfLEZv7ZRF7iTai5Hsya0c4tiNrrVE
|
|
111
105
|
runbooks/inventory/account_class.py,sha256=wvYNeiXHq6tk8Pqa95Aa91zAtuBXcnE51NonzDueuaM,26361
|
112
106
|
runbooks/inventory/all_my_instances_wrapper.py,sha256=B_nHnXOFle6_LU1YnZd38uMZNV6pIONh4EvCyO-lwzw,5723
|
113
107
|
runbooks/inventory/aws_decorators.py,sha256=_3QWqih_J6tgs7_dnJwp7Al7OI0qImZpFMyO4E-bMZE,8605
|
114
|
-
runbooks/inventory/
|
108
|
+
runbooks/inventory/aws_organization.png,sha256=-LUsSMk9L-sPF6K3Z__FOnHIP7u4nQW9Q1rcTw1EzX8,1140649
|
115
109
|
runbooks/inventory/check_cloudtrail_compliance.py,sha256=rQGKuJefqBa1LCfTsVgKJ_GiP3HKqgpYX77iclOV2ko,33652
|
116
110
|
runbooks/inventory/check_controltower_readiness.py,sha256=2elNsYY_PYhcQeyjcnB4NTbZVUrHnXU70OjrzwOpwVI,56076
|
117
111
|
runbooks/inventory/check_landingzone_readiness.py,sha256=K7UayaO7QRIhNa0ewZk-Ks4iRAjUPVgMFfjkbgHVOYw,35934
|
118
112
|
runbooks/inventory/cloudtrail.md,sha256=wMgU8ki4fWjoiO9SdDGxRADtdVUVEmD6KD4tjyFtLQk,21929
|
119
|
-
runbooks/inventory/delete_s3_buckets_objects.py,sha256=o7nQQRdOXa3oW0Kfd-f1RwuLA7O5aLhg5gium3djjC0,6007
|
120
113
|
runbooks/inventory/discovery.md,sha256=cKfHx4EFMLnH3R0VIaQ3_ygx9rvAA96tC2mWqQNxowA,6079
|
121
114
|
runbooks/inventory/draw_org_structure.py,sha256=gMrXIs0FQkUCPgTRbTRwgTqLWBNzbcHZ6FFQ5L9hy0k,29769
|
122
115
|
runbooks/inventory/ec2_vpc_utils.py,sha256=bQWvEhe6hqxfj-hgpwu_ZZ9YJbfKiEbgJcAFWhwih-M,16627
|
@@ -153,20 +146,15 @@ runbooks/inventory/list_sns_topics.py,sha256=qn1YlsZtpZSdC7lbFudBZCgW8w8DwUlVpzA
|
|
153
146
|
runbooks/inventory/list_ssm_parameters.py,sha256=uA-69R5fGK-cPntBhliffPfki5igDQReD5q0XKHtUj8,19881
|
154
147
|
runbooks/inventory/list_vpc_subnets.py,sha256=HcKjbmU9mydJhC7QQ4f4C4MzRF6pY9xf-gCdE_42DnI,19001
|
155
148
|
runbooks/inventory/list_vpcs.py,sha256=b_54AqH_IgpJ_Qe4VcU-XKmvhfmc5rEJBLWldZw2lF4,18120
|
156
|
-
runbooks/inventory/lockdown_cfn_stackset_role.py,sha256=1qiG845cVpab3tzLT9JmVTPq4CufSExNQQRd1rm1kHo,8282
|
157
149
|
runbooks/inventory/recover_cfn_stack_ids.py,sha256=_KgQgDgZRxeyzUb5im6RM-gORZL9WmD03jKpruwp3os,8638
|
158
150
|
runbooks/inventory/requirements.txt,sha256=W8mvfeKf86CfTIeRJyqa978xJ77Cjfh4mlQ3Gb4YrCc,213
|
159
151
|
runbooks/inventory/run_on_multi_accounts.py,sha256=ecyzqffcHAoWovjoUlT643duC3sCdpCAz6z-S8vEIwU,8586
|
160
|
-
runbooks/inventory/update_aws_actions.py,sha256=y95kGJQFCt94OMWW6Dgx_R0dCJHbpx9FUQhOsfBsICc,5594
|
161
|
-
runbooks/inventory/update_cfn_stacksets.py,sha256=OlAQVT34zm1gJRp90e0GIyCWFHNzL99r9MjPxGVgwyo,64229
|
162
|
-
runbooks/inventory/update_cloudwatch_logs_retention_policy.py,sha256=WSjxo0Jiuqs_HrTKvTYBH9ISakXpusf4Iz5c45XfqdQ,12340
|
163
|
-
runbooks/inventory/update_iam_roles_cross_accounts.py,sha256=BfOqs4vdvkGVh9JvQtYr7kbG8Lmq2APQWi4vW3R84jY,21038
|
164
|
-
runbooks/inventory/update_s3_public_access_block.py,sha256=zLx4_eruUbXxsqlOcNbqcVNs7_FWjk87UdQDL3IPylg,22916
|
165
152
|
runbooks/inventory/verify_ec2_security_groups.py,sha256=iFX5AlRJWaU0DP-gwdOrsXc3zNwsRZbjZeyjcn0YMUA,68221
|
166
153
|
runbooks/inventory/LandingZone/delete_lz.py,sha256=hMwv-T8RTjQQdx9oLelABibFHGD9TFR0xkI_Hgfabw0,48920
|
167
|
-
runbooks/inventory/collectors/__init__.py,sha256=
|
154
|
+
runbooks/inventory/collectors/__init__.py,sha256=gmRyAeXqZt-0KgBD4eh77zQs-dcxpKVci0470yZInMg,1101
|
168
155
|
runbooks/inventory/collectors/aws_compute.py,sha256=MzxNqE1YWRdTVtLyJNNXgWabyvLU1kKoiKpe9Cn0RdU,21018
|
169
|
-
runbooks/inventory/collectors/
|
156
|
+
runbooks/inventory/collectors/aws_management.py,sha256=kRB3mxCGXq3TfXlINzdhxIb0sB6CzGoO698JeuyKLWc,32932
|
157
|
+
runbooks/inventory/collectors/aws_networking.py,sha256=8PbLVWrg_wls5a7NJm59e09WSglPwVGpL5wL48TeDDs,11425
|
170
158
|
runbooks/inventory/collectors/base.py,sha256=cOFE-zUOOWYQJPxK0p9lwqPfBopS_bfX_LBrc9qq5TY,7371
|
171
159
|
runbooks/inventory/core/__init__.py,sha256=kCH8dKMGp3bAYNPQI7OegiQdglV0G1k36gUtAKT6avE,562
|
172
160
|
runbooks/inventory/core/collector.py,sha256=YYeAKgbVlJmltwZoPBCtacTSz5HYTwkEjL7z2IWjEcE,11769
|
@@ -190,48 +178,100 @@ runbooks/inventory/utils/__init__.py,sha256=c6bQD-Foq3U8tw-JK8PYR-o8K5MwJ3mJWkKi
|
|
190
178
|
runbooks/inventory/utils/aws_helpers.py,sha256=rg1L69An3PLVWrTTiHGjL29Z8N51rOVYLostN8CCcwk,17124
|
191
179
|
runbooks/inventory/utils/threading_utils.py,sha256=ckizvb0QSWx1xkDanvaoUOCHaXOm2E6Abg1VQFxfJrU,16067
|
192
180
|
runbooks/inventory/utils/validation.py,sha256=HoQmEr9CSEfS1yF0uyCAW5TKlG-u9-t-YRouThSBxeA,19803
|
193
|
-
runbooks/
|
194
|
-
runbooks/
|
195
|
-
runbooks/
|
196
|
-
runbooks/
|
197
|
-
runbooks/
|
198
|
-
runbooks/
|
199
|
-
runbooks/
|
200
|
-
runbooks/
|
201
|
-
runbooks/
|
202
|
-
runbooks/
|
203
|
-
runbooks/
|
204
|
-
runbooks/
|
205
|
-
runbooks/
|
206
|
-
runbooks/
|
207
|
-
runbooks/
|
208
|
-
runbooks/
|
209
|
-
runbooks/
|
210
|
-
runbooks/
|
211
|
-
runbooks/
|
212
|
-
runbooks/
|
213
|
-
runbooks/
|
214
|
-
runbooks/
|
215
|
-
runbooks/
|
216
|
-
runbooks/
|
217
|
-
runbooks/
|
218
|
-
runbooks/
|
219
|
-
runbooks/
|
220
|
-
runbooks/
|
221
|
-
runbooks/
|
222
|
-
runbooks/
|
223
|
-
runbooks/
|
224
|
-
runbooks/
|
225
|
-
runbooks/
|
226
|
-
runbooks/
|
227
|
-
runbooks/
|
228
|
-
runbooks/
|
229
|
-
runbooks/
|
181
|
+
runbooks/operate/__init__.py,sha256=ENzoZHKqyMf67UAoRUW2furRH-AmJBfHmmAsDZG0vXU,7258
|
182
|
+
runbooks/operate/base.py,sha256=-pgIOqCzCH-0nNiZWVvp4efy26g7K4l2KgDMcpJRhng,10154
|
183
|
+
runbooks/operate/cloudformation_operations.py,sha256=U6zDeDnnGUiOu1GXCYtC_5g2LJMqzic6RX61VsYejfw,24481
|
184
|
+
runbooks/operate/cloudwatch_operations.py,sha256=CHqJ-vf9dh_AhnEZ6lrr9BYM4QKiMGYnSa7Qc4lwXPo,19071
|
185
|
+
runbooks/operate/dynamodb_operations.py,sha256=jqG3Bj6um2nWNzOcAv8aoNac2R4Slws8CoN9BC55fVo,31363
|
186
|
+
runbooks/operate/ec2_operations.py,sha256=uZDHoXPKtuXNb-DmDT5zZJ5xmmkZOQT_Ga02r1mKob4,38305
|
187
|
+
runbooks/operate/iam_operations.py,sha256=0x6LWczQsSNBgQgXZAJLXM1kMwMIfH5pqwMmU72jQig,21378
|
188
|
+
runbooks/operate/s3_operations.py,sha256=k6cXa-NVzikj5ODZgLtuo417hzyJJVHE9cIzTGV4NwA,47107
|
189
|
+
runbooks/operate/tagging_operations.py,sha256=UMyiXTly6hy7ZrehalHQmWaAG1lKVW2yviOUFDY7zv8,26228
|
190
|
+
runbooks/operate/tags.json,sha256=-Y77SDvrvn0sCdsxgdRwu0sl0mih2Ib_N6nGi-UtE5U,513
|
191
|
+
runbooks/remediation/CLAUDE.md,sha256=E7u7DX4nso7yN4suoV7HS1T52058zdUNfiExZkEVd1o,3999
|
192
|
+
runbooks/remediation/DOME9.md,sha256=g2qMJmkoMdfUZWoGufo-tNXPLFV9utDlsWatAKsflnY,43743
|
193
|
+
runbooks/remediation/README.md,sha256=qoO6D8qaF5o5K-yBoGfslu8ChaijWnWJaqh_AveqLV8,386
|
194
|
+
runbooks/remediation/__init__.py,sha256=SXEBVUfyhLG-0Tv_xzxK7m0WZuZcuZqWr_XderTAPPc,3422
|
195
|
+
runbooks/remediation/acm_cert_expired_unused.py,sha256=_SfttBHKMBfXNtI1006Ci1dCYDgqhCEGGI5Ua3RvQGk,3541
|
196
|
+
runbooks/remediation/acm_remediation.py,sha256=ypazDHcwn9UeC3S3Lx9e7ML1E--ogyoJUhvrmCxZSdo,38824
|
197
|
+
runbooks/remediation/api_gateway_list.py,sha256=7RyTSmmhQaezNt9Ksh_BktSAPaQ7DGKQeBviqbkEdS0,7180
|
198
|
+
runbooks/remediation/base.py,sha256=X9HoL9hluT13yRctOq4WQTPCX1Y1gxQImBpMjZgpPcM,24480
|
199
|
+
runbooks/remediation/cloudtrail_remediation.py,sha256=ZL58kNB_bQJRooZDH8HYF7FgTiLP0lSIfyYLqhMWTcc,38390
|
200
|
+
runbooks/remediation/cloudtrail_s3_modifications.py,sha256=DaN6DmvTgZk4D2QlxXEJ4yUc1m1oi7U1myNX7krA00Q,13147
|
201
|
+
runbooks/remediation/cognito_active_users.py,sha256=ZKtludgCL0ufWiWpiodfD8DNRKSiIMWcQeBBBANH4o8,2973
|
202
|
+
runbooks/remediation/cognito_remediation.py,sha256=7H2J_q_xdKY44wXfQG3gNm60rcAhOED2M7SA73r2T3k,36966
|
203
|
+
runbooks/remediation/cognito_user_password_reset.py,sha256=1pBLS9Ccdu8ohflGcbsBI-HLKLbNYsU39sijielAcQk,6902
|
204
|
+
runbooks/remediation/commons.py,sha256=f3QcUHyZ0fRHWYvh3NNVJoittoS8eEeVZ7cUiGWFseQ,15348
|
205
|
+
runbooks/remediation/dynamodb_optimize.py,sha256=CKezH6osJlW44kpu47STN0K6Q9EbL69FYr2SmwjcHmw,5987
|
206
|
+
runbooks/remediation/dynamodb_remediation.py,sha256=IZNjvXaXrHaZmwqnS_Fqc2Oe7ALHPt7CzWQl6p6vqSU,30872
|
207
|
+
runbooks/remediation/dynamodb_server_side_encryption.py,sha256=wnXwRcXzR3dFpcsA-5CjyCvPBixOiflN2H8Rfdp8Wao,3802
|
208
|
+
runbooks/remediation/ec2_public_ips.py,sha256=BcTi7QGihyy5brPa2zJSiqk0fcFYok5YO96B6GrEf68,5331
|
209
|
+
runbooks/remediation/ec2_remediation.py,sha256=8LT5mMwG3wz2XcOtKk0wyd3RAJi4lxwJkJh33uB4Xoo,37035
|
210
|
+
runbooks/remediation/ec2_subnet_disable_auto_ip_assignment.py,sha256=UeXqp2qTCj2oXwGKXH_6H1PcBQANjMAXXIKADH1kOd4,2723
|
211
|
+
runbooks/remediation/ec2_unattached_ebs_volumes.py,sha256=ijQh4yEqpGsBMNA4UkRUVvXVQIdYY6sxRBLtGcNxeM8,18987
|
212
|
+
runbooks/remediation/ec2_unused_security_groups.py,sha256=YKG4-UBipJEdoMvy1Pt5-j3CdK-4LlmdXSJ3wyxZdNA,8512
|
213
|
+
runbooks/remediation/kms_enable_key_rotation.py,sha256=oOgiRXHE2j59bGCNoWq-JUs2-okTLqB48G2Vk86VbzA,27587
|
214
|
+
runbooks/remediation/kms_remediation.py,sha256=Gfb3Yi98gerN_0UaEcw6b6MFkGSvbvWrZq5r-SSYfFE,29381
|
215
|
+
runbooks/remediation/lambda_list.py,sha256=B5dQzg_nWXbuC-h0TuCE1hH26Rsm5jeNkmRZrbYGekM,10925
|
216
|
+
runbooks/remediation/lambda_remediation.py,sha256=SF_vPM9qgUwg514g1eFqnU90RcJKHvkl4LQYNJ8JZh4,42553
|
217
|
+
runbooks/remediation/multi_account.py,sha256=fjlQsRCKUw3QRRsoUGBy0zCtVyzMJyCUfHdqY-oNRHo,22062
|
218
|
+
runbooks/remediation/rds_instance_list.py,sha256=Nl1Pe1DDBZBl3SDjnY2i51IrcErELgCh2W1EXQyu_Dc,8476
|
219
|
+
runbooks/remediation/rds_remediation.py,sha256=a2FAL19uDPng1n3_gfW75VyRfLf3hkTKz-7yqsqNpW0,37069
|
220
|
+
runbooks/remediation/rds_snapshot_list.py,sha256=7ImBYvHScpP_TxnccE2pWbwuiYlblZKtXZ1YzsSVLiY,7933
|
221
|
+
runbooks/remediation/requirements.txt,sha256=wXKN9AHGCJlvGWbOrqpfPNIhnPU6CnV2reRGnG13Ims,2091
|
222
|
+
runbooks/remediation/s3_block_public_access.py,sha256=DTQZwPpw8el8KWGPKDTZggRGi_tZZtUMA7-r5cQesS0,6331
|
223
|
+
runbooks/remediation/s3_bucket_public_access.py,sha256=eejdaWik_QpWHIMAZSdHWVckJBHL3VkXRBCIDFcVVVI,5533
|
224
|
+
runbooks/remediation/s3_disable_static_website_hosting.py,sha256=08CeFqDfGpLRAwGVJQDiEyA2ct_pHSXiSh9Wt0_iIOI,2749
|
225
|
+
runbooks/remediation/s3_downloader.py,sha256=WteUk1xMiiUdnUOeC_O3RhbAVSEfKB4XyYbWSW29lT4,8777
|
226
|
+
runbooks/remediation/s3_enable_access_logging.py,sha256=TusrVRPw3s4e8lHiz2q9-teqFCjA4ZtE7eBEV_x9cN0,24672
|
227
|
+
runbooks/remediation/s3_encryption.py,sha256=h87qHjwRosUZwqbN4a1n26dncANcwESbSK2h0cZ_dSw,21064
|
228
|
+
runbooks/remediation/s3_force_ssl_secure_policy.py,sha256=j-p0T5xjk8l4wIgtW07yYuoWIYhcDyVL_UgdrdNGPDY,5219
|
229
|
+
runbooks/remediation/s3_list.py,sha256=PB7MqI13GYR6-PhYtqf3MIdURWbd1dVKdSSDUoubmVE,6313
|
230
|
+
runbooks/remediation/s3_object_search.py,sha256=8MnbwVwz2qZ0IK_C_uzMwNCfMnkB24d8JgrIN03lqSo,7904
|
231
|
+
runbooks/remediation/s3_remediation.py,sha256=8YHanqrYPDbr4LQQXwcukY_p68f3fs26ZtHIg-WepL8,33014
|
232
|
+
runbooks/remediation/scan_for_phrase.py,sha256=FgTpDXnLg1tdnU6aYTmvOZu9CMjZMsfrZCNOSLqL4P4,18958
|
233
|
+
runbooks/remediation/workspaces_list.py,sha256=M6UGSmHT_IfTD2Dk58fO0b38wAp3Rb7IXvuI0S46Inw,9426
|
234
|
+
runbooks/remediation/Tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
235
|
+
runbooks/remediation/Tests/update_policy.py,sha256=7jb5hMR6jVbCUwzl5MHVqxrIGFN9_2-trIMUV-R7Kls,2999
|
236
|
+
runbooks/security/README.md,sha256=NiOHsV8Kal5LHh3mJtEjw30rCjx-9JjnMzPjXe4_Hzo,17850
|
237
|
+
runbooks/security/__init__.py,sha256=jKxqHN-gusuxgMwUIGewrP8endsyXwBxTFTSurId1cA,1844
|
238
|
+
runbooks/security/config-origin.json,sha256=3mijAIymVtkf1V_BzDJPnQSBSFjrYyL-wrPBH3t8gXQ,1009
|
239
|
+
runbooks/security/config.json,sha256=3mijAIymVtkf1V_BzDJPnQSBSFjrYyL-wrPBH3t8gXQ,1009
|
240
|
+
runbooks/security/permission.json,sha256=3p9xDYEKLfOT171GE8gV2dAjgw2TFNoggGB65w2q-L8,1261
|
241
|
+
runbooks/security/report_generator.py,sha256=KUDGJDGL7XrW1LT_KmPpED5ZgNNx8X2o-Q1ivrEeGsY,6483
|
242
|
+
runbooks/security/report_template_en.html,sha256=UARo0jfvNe41W9m70r_U6kqw8arq8N7Y0G5bqq6Mk5w,7983
|
243
|
+
runbooks/security/report_template_jp.html,sha256=UARo0jfvNe41W9m70r_U6kqw8arq8N7Y0G5bqq6Mk5w,7983
|
244
|
+
runbooks/security/report_template_kr.html,sha256=m3lf59ef12qaLsd_Zs2uZlYHVru0tQwt-e7q9odrvhc,10383
|
245
|
+
runbooks/security/report_template_vn.html,sha256=UARo0jfvNe41W9m70r_U6kqw8arq8N7Y0G5bqq6Mk5w,7983
|
246
|
+
runbooks/security/run_script.py,sha256=TrydLAuZ6_1AOo-CeNRqCYWABXDXAniyQ506KP6IRKI,2322
|
247
|
+
runbooks/security/security_baseline_tester.py,sha256=xMQ8Pp6dp1X_SU42AoAfZiezjHf95vrJEEAzuIxpU-Q,7839
|
248
|
+
runbooks/security/checklist/__init__.py,sha256=gXjVSA36zv5jCkaw3XASG8DpLPo6Fu8yxquUdX8YSFY,455
|
249
|
+
runbooks/security/checklist/account_level_bucket_public_access.py,sha256=_sILKNiBg-33wUUxoZhUq2O-x-xC2zZU9cQUehYMxTs,3386
|
250
|
+
runbooks/security/checklist/alternate_contacts.py,sha256=D65xPRbiregtYQ76kkKjy9GxHbbI_HWGEVF7Sbeu_bU,3172
|
251
|
+
runbooks/security/checklist/bucket_public_access.py,sha256=uwMUTtzIFLX_tDpxwo55Tdv_On69vBHpPIEQqigs5SY,3354
|
252
|
+
runbooks/security/checklist/cloudwatch_alarm_configuration.py,sha256=z7jiRJNA-RXUptXE9mLAXDwahHT-LVvuUcePoSg0PFw,2360
|
253
|
+
runbooks/security/checklist/direct_attached_policy.py,sha256=zjM3olLXjlaHQxHEOYyifTiugICuLAAOCMxn9pSLKFw,2568
|
254
|
+
runbooks/security/checklist/guardduty_enabled.py,sha256=IvWjHYjgT6Qv072ZG5okW4zK02azvOw7K1DNM-InlcE,2546
|
255
|
+
runbooks/security/checklist/iam_password_policy.py,sha256=bKIxhWQQ4xuE_uxtWfm0LXCqTFRQ-ygafxMKqeFFGw4,1570
|
256
|
+
runbooks/security/checklist/iam_user_mfa.py,sha256=H3mG_rC01iF-lbKCT7IqOEyShby9QkSADXE9BOt1DyQ,1234
|
257
|
+
runbooks/security/checklist/multi_region_instance_usage.py,sha256=ziDY6lHlpsmk2f_2Z8EaZ7wOUZuaUnZiI-x_R3o50Y0,2007
|
258
|
+
runbooks/security/checklist/multi_region_trail.py,sha256=OCAejEa59rKUWU-vnVQaNxOg1wOAUQZdGzyI7r25vi4,2293
|
259
|
+
runbooks/security/checklist/root_access_key.py,sha256=8jgRebbSmnKAPrTUh5uV_tC6nz7a7-qnME6uDLI99UM,2565
|
260
|
+
runbooks/security/checklist/root_mfa.py,sha256=X8PPzRLgaNhd-MMUjm432OkjQ1RqGis-pEhQUgqwVa8,1293
|
261
|
+
runbooks/security/checklist/root_usage.py,sha256=20XEtXC2seJnUW0clME3YGrosRYP5yRTi7a_Rr5YpdA,4658
|
262
|
+
runbooks/security/checklist/trail_enabled.py,sha256=kcX7sgB7NO2YbN8i3SDkB1m5Bb00Wu6JX9cniGBsSPw,2289
|
263
|
+
runbooks/security/checklist/trusted_advisor.py,sha256=zsLQf-mFeu3aiOhGndrojoa5K4QiI1Buk5rC5Hfg_gA,674
|
264
|
+
runbooks/security/utils/__init__.py,sha256=fEyCpWrJ6S6Z5rdHJGf7WRMnRNoZ6th5HmXbESc6guM,96
|
265
|
+
runbooks/security/utils/common.py,sha256=pOLbkvdkBpLcbf4NSlwghhs7mr7S_MMvW9D7LvJ6hkE,3446
|
266
|
+
runbooks/security/utils/enums.py,sha256=BGr8EgwZrWsU8kvWkwWsPqELUPGBc2tvJ5SzN9XhWQU,1258
|
267
|
+
runbooks/security/utils/language.py,sha256=MrSAojEyjHqRDDALdk002snj4xnFbwGgIjAc2buJ8g0,60448
|
268
|
+
runbooks/security/utils/level_const.py,sha256=l8uYBmgEMjIQTGVVuXPAfDd_Psl6jNfTQw2isI43zO8,88
|
269
|
+
runbooks/security/utils/permission_list.py,sha256=nq06vlILHp9rfnCpJauCmFCOEGdgFMF-XO3uBFrrd-o,767
|
230
270
|
runbooks/utils/__init__.py,sha256=3K-CwUA_NEN9R7RT5PeELs-VLSgVKUfkV-4NJkbCg90,5770
|
231
271
|
runbooks/utils/logger.py,sha256=ifxqLjDlZoDaG8rtAGVKLZ5dAwcMn16rB4YgMfeUC3E,972
|
232
|
-
runbooks-0.
|
233
|
-
runbooks-0.
|
234
|
-
runbooks-0.
|
235
|
-
runbooks-0.
|
236
|
-
runbooks-0.
|
237
|
-
runbooks-0.
|
272
|
+
runbooks-0.7.5.dist-info/licenses/LICENSE,sha256=WAQUYGIkLJh6CPrlZgr0IsbRODa0EZ6fboBXGjfWggs,11375
|
273
|
+
runbooks-0.7.5.dist-info/METADATA,sha256=hQazW_8ifwWJTCGSQKpt5hPo3Q1NmQKgKPU5nvQwidM,26214
|
274
|
+
runbooks-0.7.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
275
|
+
runbooks-0.7.5.dist-info/entry_points.txt,sha256=OUdFCP5rg5Q1bS1lqyZ8z1NjdGMyIj3t1M7eHd6CRuM,223
|
276
|
+
runbooks-0.7.5.dist-info/top_level.txt,sha256=dC5G9UiKrI_9_0dBLWwpGi1JFPRp_Qspi23URlD5WyU,32
|
277
|
+
runbooks-0.7.5.dist-info/RECORD,,
|
@@ -1,7 +1,6 @@
|
|
1
1
|
[console_scripts]
|
2
2
|
cfat = runbooks.cfat.cli:main
|
3
3
|
runbooks = runbooks.main:main
|
4
|
-
runbooks-aws = runbooks.aws:run_script
|
5
4
|
runbooks-cfat = runbooks.cfat.cli:main
|
6
5
|
runbooks-finops = runbooks.finops.cli:main
|
7
6
|
runbooks-security = runbooks.security_baseline.run_script:main
|
runbooks/aws/__init__.py
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
## src/runbooks/aws/__init__.py
|
2
|
-
"""AWS Runbooks Initialization Module."""
|
3
|
-
|
4
|
-
import importlib
|
5
|
-
import os
|
6
|
-
import sys
|
7
|
-
|
8
|
-
from runbooks.utils.logger import configure_logger
|
9
|
-
|
10
|
-
logger = configure_logger(__name__)
|
11
|
-
|
12
|
-
|
13
|
-
def discover_scripts():
|
14
|
-
"""
|
15
|
-
Dynamically discovers and lists all AWS scripts in this package.
|
16
|
-
|
17
|
-
Returns:
|
18
|
-
dict: A mapping of script names to their main functions.
|
19
|
-
"""
|
20
|
-
scripts = {}
|
21
|
-
aws_path = os.path.dirname(__file__)
|
22
|
-
for filename in os.listdir(aws_path):
|
23
|
-
if filename.endswith(".py") and filename != "__init__.py":
|
24
|
-
module_name = f"runbooks.aws.{filename[:-3]}"
|
25
|
-
try:
|
26
|
-
module = importlib.import_module(module_name)
|
27
|
-
if hasattr(module, "main"):
|
28
|
-
scripts[filename[:-3]] = module.main
|
29
|
-
except Exception as e:
|
30
|
-
logger.error(f"Error importing {module_name}: {e}")
|
31
|
-
return scripts
|
32
|
-
|
33
|
-
|
34
|
-
def run_script(script_name, *args):
|
35
|
-
"""
|
36
|
-
Executes the given script by name.
|
37
|
-
|
38
|
-
Args:
|
39
|
-
script_name (str): The name of the script to execute.
|
40
|
-
*args: Additional arguments to pass to the script.
|
41
|
-
"""
|
42
|
-
scripts = discover_scripts()
|
43
|
-
if script_name in scripts:
|
44
|
-
try:
|
45
|
-
scripts[script_name](*args)
|
46
|
-
except Exception as e:
|
47
|
-
logger.error(f"Error executing script {script_name}: {e}")
|
48
|
-
else:
|
49
|
-
logger.error(f"Script {script_name} not found.")
|
50
|
-
sys.exit(1)
|
51
|
-
|
52
|
-
|
53
|
-
if __name__ == "__main__":
|
54
|
-
if len(sys.argv) < 2:
|
55
|
-
logger.error("Usage: python -m runbooks.aws <script_name> [<args>]")
|
56
|
-
sys.exit(1)
|
57
|
-
|
58
|
-
run_script(sys.argv[1], *sys.argv[2:])
|
@@ -1,231 +0,0 @@
|
|
1
|
-
#!/usr/bin/env python3
|
2
|
-
|
3
|
-
"""
|
4
|
-
DynamoDB Operations: Put Item, Delete Item, and Batch Write.
|
5
|
-
|
6
|
-
This script supports the following functionalities:
|
7
|
-
1. Insert or update a single item (Put Item).
|
8
|
-
2. Retrieve and delete a single item (Delete Item).
|
9
|
-
3. Batch insert multiple items efficiently (Batch Write).
|
10
|
-
|
11
|
-
Designed for usage in Python, Docker, and AWS Lambda environments.
|
12
|
-
|
13
|
-
Author: nnthanh101@gmail.com
|
14
|
-
Date: 2025-01-09
|
15
|
-
Version: 1.0.0
|
16
|
-
"""
|
17
|
-
|
18
|
-
import json
|
19
|
-
import os
|
20
|
-
from typing import Dict, List
|
21
|
-
|
22
|
-
import boto3
|
23
|
-
from botocore.exceptions import BotoCoreError, ClientError
|
24
|
-
|
25
|
-
from runbooks.utils.logger import configure_logger
|
26
|
-
|
27
|
-
## ✅ Configure Logger
|
28
|
-
logger = configure_logger(__name__)
|
29
|
-
|
30
|
-
# ==============================
|
31
|
-
# CONFIGURATION VARIABLES
|
32
|
-
# ==============================
|
33
|
-
AWS_REGION = os.getenv("AWS_REGION", "us-east-1")
|
34
|
-
TABLE_NAME = os.getenv("TABLE_NAME", "employees")
|
35
|
-
MAX_BATCH_ITEMS = int(os.getenv("MAX_BATCH_ITEMS", 100))
|
36
|
-
|
37
|
-
|
38
|
-
# ==============================
|
39
|
-
# AWS CLIENT INITIALIZATION
|
40
|
-
# ==============================
|
41
|
-
try:
|
42
|
-
dynamodb = boto3.resource("dynamodb", region_name=AWS_REGION)
|
43
|
-
table = dynamodb.Table(TABLE_NAME)
|
44
|
-
logger.info(f"✅ DynamoDB Table '{TABLE_NAME}' initialized successfully.")
|
45
|
-
except Exception as e:
|
46
|
-
logger.error(f"❌ Failed to initialize DynamoDB table: {e}")
|
47
|
-
raise
|
48
|
-
|
49
|
-
|
50
|
-
# ==============================
|
51
|
-
# FUNCTION: PUT ITEM
|
52
|
-
# ==============================
|
53
|
-
def put_item(emp_id: str, name: str, salary: int) -> None:
|
54
|
-
"""
|
55
|
-
Inserts or updates a single item in DynamoDB.
|
56
|
-
|
57
|
-
Args:
|
58
|
-
emp_id (str): Employee ID.
|
59
|
-
name (str): Employee name.
|
60
|
-
salary (int): Employee salary.
|
61
|
-
|
62
|
-
Raises:
|
63
|
-
Exception: If item insertion fails.
|
64
|
-
"""
|
65
|
-
try:
|
66
|
-
logger.info(f"🚀 Inserting/Updating item in table '{TABLE_NAME}'...")
|
67
|
-
table.put_item(Item={"emp_id": emp_id, "name": name, "salary": salary})
|
68
|
-
logger.info(f"✅ Item added successfully: emp_id={emp_id}, name={name}, salary={salary}")
|
69
|
-
|
70
|
-
except ClientError as e:
|
71
|
-
logger.error(f"❌ AWS Client Error: {e}")
|
72
|
-
raise
|
73
|
-
|
74
|
-
except Exception as e:
|
75
|
-
logger.error(f"❌ Unexpected Error: {e}")
|
76
|
-
raise
|
77
|
-
|
78
|
-
|
79
|
-
# ==============================
|
80
|
-
# FUNCTION: DELETE ITEM
|
81
|
-
# ==============================
|
82
|
-
def delete_item(emp_id: str) -> Dict:
|
83
|
-
"""
|
84
|
-
Retrieves and deletes a single item from DynamoDB.
|
85
|
-
|
86
|
-
Args:
|
87
|
-
emp_id (str): Employee ID.
|
88
|
-
|
89
|
-
Returns:
|
90
|
-
Dict: Deleted item details.
|
91
|
-
|
92
|
-
Raises:
|
93
|
-
Exception: If retrieval or deletion fails.
|
94
|
-
"""
|
95
|
-
try:
|
96
|
-
## ✅ 1. Retrieve the item
|
97
|
-
logger.info(f"🔍 Retrieving item with emp_id={emp_id}...")
|
98
|
-
response = table.get_item(Key={"emp_id": emp_id})
|
99
|
-
|
100
|
-
if "Item" not in response:
|
101
|
-
raise ValueError(f"Item with emp_id={emp_id} not found.")
|
102
|
-
item = response["Item"]
|
103
|
-
logger.info(f"✅ Item retrieved: {item}")
|
104
|
-
|
105
|
-
## ✅ 2. Delete the item
|
106
|
-
logger.info(f"🗑️ Deleting item with emp_id={emp_id}...")
|
107
|
-
table.delete_item(Key={"emp_id": emp_id})
|
108
|
-
logger.info(f"✅ Item deleted successfully: emp_id={emp_id}")
|
109
|
-
|
110
|
-
return item
|
111
|
-
|
112
|
-
except ClientError as e:
|
113
|
-
logger.error(f"❌ AWS Client Error: {e}")
|
114
|
-
raise
|
115
|
-
|
116
|
-
except BotoCoreError as e:
|
117
|
-
logger.error(f"❌ BotoCore Error: {e}")
|
118
|
-
raise
|
119
|
-
|
120
|
-
except Exception as e:
|
121
|
-
logger.error(f"❌ Unexpected Error: {e}")
|
122
|
-
raise
|
123
|
-
|
124
|
-
|
125
|
-
# ==============================
|
126
|
-
# FUNCTION: BATCH WRITE ITEMS
|
127
|
-
# ==============================
|
128
|
-
def batch_write_items(batch_size: int = MAX_BATCH_ITEMS) -> None:
|
129
|
-
"""
|
130
|
-
Inserts multiple items into DynamoDB using batch writer.
|
131
|
-
|
132
|
-
Args:
|
133
|
-
batch_size (int): Number of items to write in a batch.
|
134
|
-
|
135
|
-
Raises:
|
136
|
-
Exception: If batch write fails.
|
137
|
-
"""
|
138
|
-
try:
|
139
|
-
logger.info(f"🚀 Starting batch write with {batch_size} items...")
|
140
|
-
with table.batch_writer() as batch:
|
141
|
-
for i in range(batch_size):
|
142
|
-
batch.put_item(
|
143
|
-
Item={
|
144
|
-
"emp_id": str(i),
|
145
|
-
"name": f"Name-{i}",
|
146
|
-
"salary": 50000 + i * 100, ## Incremental salary
|
147
|
-
}
|
148
|
-
)
|
149
|
-
logger.info(f"✅ Batch write completed successfully with {batch_size} items.")
|
150
|
-
|
151
|
-
except ClientError as e:
|
152
|
-
logger.error(f"❌ AWS Client Error: {e}")
|
153
|
-
raise
|
154
|
-
|
155
|
-
except BotoCoreError as e:
|
156
|
-
logger.error(f"❌ BotoCore Error: {e}")
|
157
|
-
raise
|
158
|
-
|
159
|
-
except Exception as e:
|
160
|
-
logger.error(f"❌ Unexpected Error: {e}")
|
161
|
-
raise
|
162
|
-
|
163
|
-
|
164
|
-
# ==============================
|
165
|
-
# MAIN FUNCTION (CLI/DOCKER)
|
166
|
-
# ==============================
|
167
|
-
def main():
|
168
|
-
"""
|
169
|
-
Main function for CLI/Docker execution.
|
170
|
-
"""
|
171
|
-
try:
|
172
|
-
## Use-Case 1: Put Item
|
173
|
-
put_item(emp_id="2", name="John Doe", salary=75000)
|
174
|
-
|
175
|
-
## Use-Case 2: Delete Item
|
176
|
-
delete_item(emp_id="2")
|
177
|
-
|
178
|
-
## Use-Case 3: Batch Write Items
|
179
|
-
batch_write_items(batch_size=MAX_BATCH_ITEMS)
|
180
|
-
|
181
|
-
except Exception as e:
|
182
|
-
logger.error(f"❌ Error in main execution: {e}")
|
183
|
-
raise
|
184
|
-
|
185
|
-
|
186
|
-
# ==============================
|
187
|
-
# AWS LAMBDA HANDLER
|
188
|
-
# ==============================
|
189
|
-
def lambda_handler(event, context):
|
190
|
-
"""
|
191
|
-
AWS Lambda handler for DynamoDB operations.
|
192
|
-
|
193
|
-
Args:
|
194
|
-
event (dict): AWS Lambda event with action details.
|
195
|
-
context: AWS Lambda context object.
|
196
|
-
|
197
|
-
Returns:
|
198
|
-
dict: Status code and message.
|
199
|
-
"""
|
200
|
-
try:
|
201
|
-
action = event.get("action")
|
202
|
-
emp_id = event.get("emp_id")
|
203
|
-
name = event.get("name")
|
204
|
-
salary = event.get("salary", 0)
|
205
|
-
batch_size = int(event.get("batch_size", MAX_BATCH_ITEMS))
|
206
|
-
|
207
|
-
if action == "put":
|
208
|
-
put_item(emp_id, name, salary)
|
209
|
-
return {"statusCode": 200, "body": f"Item {emp_id} inserted."}
|
210
|
-
|
211
|
-
elif action == "delete":
|
212
|
-
item = delete_item(emp_id)
|
213
|
-
return {"statusCode": 200, "body": f"Item {item} deleted."}
|
214
|
-
|
215
|
-
elif action == "batch_write":
|
216
|
-
batch_write_items(batch_size)
|
217
|
-
return {"statusCode": 200, "body": "Batch write completed."}
|
218
|
-
|
219
|
-
else:
|
220
|
-
raise ValueError("Invalid action. Use 'put', 'delete', or 'batch_write'.")
|
221
|
-
|
222
|
-
except Exception as e:
|
223
|
-
logger.error(f"❌ Lambda Error: {e}")
|
224
|
-
return {"statusCode": 500, "body": str(e)}
|
225
|
-
|
226
|
-
|
227
|
-
# ==============================
|
228
|
-
# SCRIPT ENTRY POINT
|
229
|
-
# ==============================
|
230
|
-
if __name__ == "__main__":
|
231
|
-
main()
|