You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description: Name of the S3 Bucket to be created to hold data information.
@@ -19,6 +15,9 @@ Parameters:
19
15
Type: String
20
16
Description: The name of what this cf is doing.
21
17
Default: resilience-hub
18
+
GlueRoleARN:
19
+
Type: String
20
+
Description: Arn for the Glue Crawler role
22
21
Schedule:
23
22
Type: String
24
23
Description: EventBridge Schedule to trigger the data collection
@@ -47,10 +46,13 @@ Parameters:
47
46
SchedulerExecutionRoleARN:
48
47
Type: String
49
48
Description: Common role for module Scheduler execution
50
-
# DataBucketsKmsKeysArns:
51
-
# Type: String
52
-
# Description: "ARNs of KMS Keys for data buckets and/or Glue Catalog. Comma separated list, no spaces. Keep empty if data Buckets and Glue Catalog are not Encrypted with KMS. You can also set it to '*' to grant decrypt permission for all the keys."
53
-
# Default: ""
49
+
DataBucketsKmsKeysArns:
50
+
Type: String
51
+
Description: "ARNs of KMS Keys for data buckets and/or Glue Catalog. Comma separated list, no spaces. Keep empty if data Buckets and Glue Catalog are not Encrypted with KMS. You can also set it to '*' to grant decrypt permission for all the keys."
''' This code will go through all regions in given linked account and pull data from Resilience Hub (only applications with assessment updated since last pull)
138
+
to preform full pull remove 'resilience-hub' folder on s3 and rerun StepFunction
139
+
'''
109
140
import os
110
141
import json
111
142
import logging
@@ -133,7 +164,7 @@ Resources:
133
164
yield from response.get(result_key, [])
134
165
next_token = response.get('NextToken') or response.get('nextToken')
with s3_uploader(f'{module_name}/{module_name}-resiliency_policy/payer={payer_id}/account={account_id}/region_code={region}/{policy_id}.json') as write_policy:
300
+
with s3_uploader(f'{module_name}/{module_name}-resiliency_policy/payer_id={payer_id}/account_id={account_id}/region_code={region}/{policy_id}.json') as write_policy:
270
301
write_policy(policy_response['policy'])
271
302
272
303
except Exception as e:
273
304
print(f"Error getting policy details: {str(e)}")
274
305
275
306
# Loop over list of assessments to get the latest successful
276
307
latest_assessment = None
277
-
with s3_uploader(f'{module_name}/{module_name}-assessments/payer={payer_id}/account={account_id}/region_code={region}/app={app_id}/all.json') as write_assessment:
308
+
with s3_uploader(f'{module_name}/{module_name}-assessments/payer_id={payer_id}/account_id={account_id}/region_code={region}/app={app_id}/all.json') as write_assessment:
278
309
for assessment in paginate(resilience_client.list_app_assessments, 'assessmentSummaries', appArn=app_arn):
279
310
if assessment['assessmentStatus'] == 'Success':
280
311
if not latest_assessment or latest_assessment['endTime'] < assessment['endTime']:
with s3_uploader(f'{module_name}/{module_name}-app_component_recommendations/payer={payer_id}/account={account_id}/region_code={region}/app={app_id}/latest.json') as write:
322
+
with s3_uploader(f'{module_name}/{module_name}-app_component_recommendations/payer_id={payer_id}/account_id={account_id}/region_code={region}/app={app_id}/latest.json') as write:
292
323
for rec in paginate(resilience_client.list_app_component_recommendations, 'componentRecommendations', assessmentArn=latest_assessment['assessmentArn']):
293
324
write(rec)
294
325
295
-
296
-
with s3_uploader(f'{module_name}/{module_name}-alarm_recommendations/payer={payer_id}/account={account_id}/region_code={region}/app={app_id}/latest.json') as write:
326
+
with s3_uploader(f'{module_name}/{module_name}-alarm_recommendations/payer_id={payer_id}/account_id={account_id}/region_code={region}/app={app_id}/latest.json') as write:
297
327
total = outstanding = excluded = 0
298
328
for rec in paginate(resilience_client.list_alarm_recommendations, 'alarmRecommendations', assessmentArn=latest_assessment['assessmentArn']):
299
329
status = rec.get('recommendationStatus', '') # 'recommendationStatus': 'Implemented'|'Inactive'|'NotImplemented'|'Excluded',
@@ -307,7 +337,7 @@ Resources:
307
337
app_data['alarms_outstanding'] = str(outstanding)
308
338
app_data['alarms_excluded'] = str(excluded)
309
339
310
-
with s3_uploader(f'{module_name}/{module_name}-sop_recommendations/payer={payer_id}/account={account_id}/region_code={region}/app={app_id}/latest.json') as write:
340
+
with s3_uploader(f'{module_name}/{module_name}-sop_recommendations/payer_id={payer_id}/account_id={account_id}/region_code={region}/app={app_id}/latest.json') as write:
311
341
total = outstanding = excluded = 0
312
342
for rec in paginate(resilience_client.list_sop_recommendations, 'sopRecommendations', assessmentArn=latest_assessment['assessmentArn']):
313
343
status = rec.get('recommendationStatus', '') # 'recommendationStatus': 'Implemented'|'Inactive'|'NotImplemented'|'Excluded',
@@ -321,7 +351,7 @@ Resources:
321
351
app_data['sops_outstanding'] = str(outstanding)
322
352
app_data['sops_excluded'] = str(excluded)
323
353
324
-
with s3_uploader(f'{module_name}/{module_name}-test_recommendations/payer={payer_id}/account={account_id}/region_code={region}/app={app_id}/latest.json') as write:
354
+
with s3_uploader(f'{module_name}/{module_name}-test_recommendations/payer_id={payer_id}/account_id={account_id}/region_code={region}/app={app_id}/latest.json') as write:
325
355
total = outstanding = excluded = 0
326
356
for rec in paginate(resilience_client.list_test_recommendations, 'testRecommendations', assessmentArn=latest_assessment['assessmentArn']):
with s3_uploader(f'{module_name}/{module_name}-compliance_drift/payer={payer_id}/account={account_id}/region_code={region}/app={app_id}/latest.json') as write:
370
+
with s3_uploader(f'{module_name}/{module_name}-compliance_drift/payer_id={payer_id}/account_id={account_id}/region_code={region}/app={app_id}/latest.json') as write:
341
371
app_component_drifts = 0
342
372
for rec in paginate(resilience_client.list_app_assessment_compliance_drift, 'complianceDrifts', assessmentArn=latest_assessment['assessmentArn']):
0 commit comments