Skip to content
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions data-collection/deploy/deploy-data-collection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Mappings:
us-west-1: {CodeBucket: aws-managed-cost-intelligence-dashboards-us-west-1 }
us-west-2: {CodeBucket: aws-managed-cost-intelligence-dashboards-us-west-2 }
StepFunctionCode:
main-v3: {TemplatePath: cfn/data-collection/source/step-functions/main-state-machine-v3.json}
main-v4: {TemplatePath: cfn/data-collection/source/step-functions/main-state-machine-v3.json}
crawler-v1: {TemplatePath: cfn/data-collection/source/step-functions/crawler-state-machine-v1.json}
standalone-v1: {TemplatePath: cfn/data-collection/source/step-functions/awsfeeds-state-machine-v1.json}

Expand Down Expand Up @@ -893,7 +893,7 @@ Resources:
LambdaAnalyticsARN: !GetAtt LambdaAnalytics.Arn
AccountCollectorLambdaARN: !Sub "${AccountCollector.Outputs.LambdaFunctionARN}"
CodeBucket: !If [ ProdCFNTemplateUsed, !FindInMap [RegionMap, !Ref "AWS::Region", CodeBucket], !Ref CFNSourceBucket ]
StepFunctionTemplate: !FindInMap [StepFunctionCode, main-v3, TemplatePath]
StepFunctionTemplate: !FindInMap [StepFunctionCode, main-v4, TemplatePath]
StepFunctionExecutionRoleARN: !GetAtt StepFunctionExecutionRole.Arn
SchedulerExecutionRoleARN: !GetAtt SchedulerExecutionRole.Arn

Expand All @@ -913,7 +913,7 @@ Resources:
LambdaAnalyticsARN: !GetAtt LambdaAnalytics.Arn
AccountCollectorLambdaARN: !Sub "${AccountCollector.Outputs.LambdaFunctionARN}"
CodeBucket: !If [ ProdCFNTemplateUsed, !FindInMap [RegionMap, !Ref "AWS::Region", CodeBucket], !Ref CFNSourceBucket ]
StepFunctionTemplate: !FindInMap [StepFunctionCode, main-v3, TemplatePath]
StepFunctionTemplate: !FindInMap [StepFunctionCode, main-v4, TemplatePath]
StepFunctionExecutionRoleARN: !GetAtt StepFunctionExecutionRole.Arn
SchedulerExecutionRoleARN: !GetAtt SchedulerExecutionRole.Arn

Expand All @@ -933,7 +933,7 @@ Resources:
LambdaAnalyticsARN: !GetAtt LambdaAnalytics.Arn
AccountCollectorLambdaARN: !Sub "${AccountCollector.Outputs.LambdaFunctionARN}"
CodeBucket: !If [ ProdCFNTemplateUsed, !FindInMap [RegionMap, !Ref "AWS::Region", CodeBucket], !Ref CFNSourceBucket ]
StepFunctionTemplate: !FindInMap [StepFunctionCode, main-v3, TemplatePath]
StepFunctionTemplate: !FindInMap [StepFunctionCode, main-v4, TemplatePath]
StepFunctionExecutionRoleARN: !GetAtt StepFunctionExecutionRole.Arn
LambdaManageGlueTableARN: !GetAtt LambdaManageGlueTable.Arn
SchedulerExecutionRoleARN: !GetAtt SchedulerExecutionRole.Arn
Expand All @@ -954,7 +954,7 @@ Resources:
LambdaAnalyticsARN: !GetAtt LambdaAnalytics.Arn
AccountCollectorLambdaARN: !Sub "${AccountCollector.Outputs.LambdaFunctionARN}"
CodeBucket: !If [ ProdCFNTemplateUsed, !FindInMap [RegionMap, !Ref "AWS::Region", CodeBucket], !Ref CFNSourceBucket ]
StepFunctionTemplate: !FindInMap [StepFunctionCode, main-v3, TemplatePath]
StepFunctionTemplate: !FindInMap [StepFunctionCode, main-v4, TemplatePath]
StepFunctionExecutionRoleARN: !GetAtt StepFunctionExecutionRole.Arn
SchedulerExecutionRoleARN: !GetAtt SchedulerExecutionRole.Arn

Expand All @@ -974,7 +974,7 @@ Resources:
LambdaAnalyticsARN: !GetAtt LambdaAnalytics.Arn
AccountCollectorLambdaARN: !Sub "${AccountCollector.Outputs.LambdaFunctionARN}"
CodeBucket: !If [ ProdCFNTemplateUsed, !FindInMap [RegionMap, !Ref "AWS::Region", CodeBucket], !Ref CFNSourceBucket ]
StepFunctionTemplate: !FindInMap [StepFunctionCode, main-v3, TemplatePath]
StepFunctionTemplate: !FindInMap [StepFunctionCode, main-v4, TemplatePath]
StepFunctionExecutionRoleARN: !GetAtt StepFunctionExecutionRole.Arn
SchedulerExecutionRoleARN: !GetAtt SchedulerExecutionRole.Arn

Expand All @@ -994,7 +994,7 @@ Resources:
LambdaAnalyticsARN: !GetAtt LambdaAnalytics.Arn
AccountCollectorLambdaARN: !Sub "${AccountCollector.Outputs.LambdaFunctionARN}"
CodeBucket: !If [ ProdCFNTemplateUsed, !FindInMap [RegionMap, !Ref "AWS::Region", CodeBucket], !Ref CFNSourceBucket ]
StepFunctionTemplate: !FindInMap [StepFunctionCode, main-v3, TemplatePath]
StepFunctionTemplate: !FindInMap [StepFunctionCode, main-v4, TemplatePath]
StepFunctionExecutionRoleARN: !GetAtt StepFunctionExecutionRole.Arn
LambdaManageGlueTableARN: !GetAtt LambdaManageGlueTable.Arn
SchedulerExecutionRoleARN: !GetAtt SchedulerExecutionRole.Arn
Expand Down Expand Up @@ -1046,7 +1046,7 @@ Resources:
LambdaAnalyticsARN: !GetAtt LambdaAnalytics.Arn
AccountCollectorLambdaARN: !Sub "${AccountCollector.Outputs.LambdaFunctionARN}"
CodeBucket: !If [ ProdCFNTemplateUsed, !FindInMap [RegionMap, !Ref "AWS::Region", CodeBucket], !Ref CFNSourceBucket ]
StepFunctionTemplate: !FindInMap [StepFunctionCode, main-v3, TemplatePath]
StepFunctionTemplate: !FindInMap [StepFunctionCode, main-v4, TemplatePath]
StepFunctionExecutionRoleARN: !GetAtt StepFunctionExecutionRole.Arn
SchedulerExecutionRoleARN: !GetAtt SchedulerExecutionRole.Arn

Expand All @@ -1066,7 +1066,7 @@ Resources:
LambdaAnalyticsARN: !GetAtt LambdaAnalytics.Arn
AccountCollectorLambdaARN: !Sub "${AccountCollector.Outputs.LambdaFunctionARN}"
CodeBucket: !If [ ProdCFNTemplateUsed, !FindInMap [RegionMap, !Ref "AWS::Region", CodeBucket], !Ref CFNSourceBucket ]
StepFunctionTemplate: !FindInMap [StepFunctionCode, main-v3, TemplatePath]
StepFunctionTemplate: !FindInMap [StepFunctionCode, main-v4, TemplatePath]
StepFunctionExecutionRoleARN: !GetAtt StepFunctionExecutionRole.Arn
SchedulerExecutionRoleARN: !GetAtt SchedulerExecutionRole.Arn
RegionsInScope:
Expand All @@ -1091,7 +1091,7 @@ Resources:
LambdaAnalyticsARN: !GetAtt LambdaAnalytics.Arn
AccountCollectorLambdaARN: !Sub "${AccountCollector.Outputs.LambdaFunctionARN}"
CodeBucket: !If [ ProdCFNTemplateUsed, !FindInMap [RegionMap, !Ref "AWS::Region", CodeBucket], !Ref CFNSourceBucket ]
StepFunctionTemplate: !FindInMap [StepFunctionCode, main-v3, TemplatePath]
StepFunctionTemplate: !FindInMap [StepFunctionCode, main-v4, TemplatePath]
StepFunctionExecutionRoleARN: !GetAtt StepFunctionExecutionRole.Arn
SchedulerExecutionRoleARN: !GetAtt SchedulerExecutionRole.Arn
RegionsInScope:
Expand All @@ -1116,7 +1116,7 @@ Resources:
LambdaAnalyticsARN: !GetAtt LambdaAnalytics.Arn
AccountCollectorLambdaARN: !Sub "${AccountCollector.Outputs.LambdaFunctionARN}"
CodeBucket: !If [ ProdCFNTemplateUsed, !FindInMap [RegionMap, !Ref "AWS::Region", CodeBucket], !Ref CFNSourceBucket ]
StepFunctionTemplate: !FindInMap [StepFunctionCode, main-v3, TemplatePath]
StepFunctionTemplate: !FindInMap [StepFunctionCode, main-v4, TemplatePath]
StepFunctionExecutionRoleARN: !GetAtt StepFunctionExecutionRole.Arn
SchedulerExecutionRoleARN: !GetAtt SchedulerExecutionRole.Arn

Expand All @@ -1136,7 +1136,7 @@ Resources:
LambdaAnalyticsARN: !GetAtt LambdaAnalytics.Arn
AccountCollectorLambdaARN: !Sub "${AccountCollector.Outputs.LambdaFunctionARN}"
CodeBucket: !If [ ProdCFNTemplateUsed, !FindInMap [RegionMap, !Ref "AWS::Region", CodeBucket], !Ref CFNSourceBucket ]
StepFunctionTemplate: !FindInMap [StepFunctionCode, main-v3, TemplatePath]
StepFunctionTemplate: !FindInMap [StepFunctionCode, main-v4, TemplatePath]
StepFunctionExecutionRoleARN: !GetAtt StepFunctionExecutionRole.Arn
SchedulerExecutionRoleARN: !GetAtt SchedulerExecutionRole.Arn

Expand All @@ -1156,7 +1156,7 @@ Resources:
LambdaAnalyticsARN: !GetAtt LambdaAnalytics.Arn
AccountCollectorLambdaARN: !Sub "${AccountCollector.Outputs.LambdaFunctionARN}"
CodeBucket: !If [ ProdCFNTemplateUsed, !FindInMap [RegionMap, !Ref "AWS::Region", CodeBucket], !Ref CFNSourceBucket ]
StepFunctionTemplate: !FindInMap [StepFunctionCode, main-v3, TemplatePath]
StepFunctionTemplate: !FindInMap [StepFunctionCode, main-v4, TemplatePath]
StepFunctionExecutionRoleARN: !GetAtt StepFunctionExecutionRole.Arn
SchedulerExecutionRoleARN: !GetAtt SchedulerExecutionRole.Arn
RegionsInScope:
Expand Down Expand Up @@ -1199,7 +1199,7 @@ Resources:
LambdaAnalyticsARN: !GetAtt LambdaAnalytics.Arn
AccountCollectorLambdaARN: !Sub "${AccountCollector.Outputs.LambdaFunctionARN}"
CodeBucket: !If [ ProdCFNTemplateUsed, !FindInMap [RegionMap, !Ref "AWS::Region", CodeBucket], !Ref CFNSourceBucket ]
StepFunctionTemplate: !FindInMap [StepFunctionCode, main-v3, TemplatePath]
StepFunctionTemplate: !FindInMap [StepFunctionCode, main-v4, TemplatePath]
StepFunctionExecutionRoleARN: !GetAtt StepFunctionExecutionRole.Arn
SchedulerExecutionRoleARN: !GetAtt SchedulerExecutionRole.Arn

Expand All @@ -1219,7 +1219,7 @@ Resources:
LambdaAnalyticsARN: !GetAtt LambdaAnalytics.Arn
AccountCollectorLambdaARN: !Sub "${AccountCollector.Outputs.LambdaFunctionARN}"
CodeBucket: !If [ ProdCFNTemplateUsed, !FindInMap [RegionMap, !Ref "AWS::Region", CodeBucket], !Ref CFNSourceBucket ]
StepFunctionTemplate: !FindInMap [StepFunctionCode, main-v3, TemplatePath]
StepFunctionTemplate: !FindInMap [StepFunctionCode, main-v4, TemplatePath]
StepFunctionExecutionRoleARN: !GetAtt StepFunctionExecutionRole.Arn
SchedulerExecutionRoleARN: !GetAtt SchedulerExecutionRole.Arn

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
"Comment": "Orchestrate the collection of ${Module} data",
"StartAt": "AccountCollectorInvoke",
"States": {
"AccountCollectorInvoke": {
"Type": "Task",
"Resource": "arn:aws:states:::lambda:invoke",
"Parameters": {
"Payload": {
"Type": "${CollectionType}"
},
"FunctionName": "${AccountCollectorLambdaARN}"
},
"Retry": [
{
"ErrorEquals": [
"Lambda.ServiceException",
"Lambda.AWSLambdaException",
"Lambda.SdkClientException",
"Lambda.TooManyRequestsException"
],
"IntervalSeconds": 2,
"MaxAttempts": 6,
"BackoffRate": 2
}
],
"Next": "AccountMap",
"ResultPath": "$.accountLambdaOutput"
},
"AccountMap": {
"Type": "Map",
"ItemProcessor": {
"ProcessorConfig": {
"Mode": "DISTRIBUTED",
"ExecutionType": "STANDARD"
},
"StartAt": "InvokeModuleLambda",
"States": {
"InvokeModuleLambda": {
"Type": "Task",
"Resource": "arn:aws:states:${DeployRegion}:${Account}:lambda:invoke",
"OutputPath": "$.Payload",
"Parameters": {
"Payload": {
"account.$": "$.account",
"params": "${Params}"
},
"FunctionName": "${ModuleLambdaARN}"
},
"Retry": [
{
"ErrorEquals": [
"Lambda.ServiceException",
"Lambda.AWSLambdaException",
"Lambda.SdkClientException",
"Lambda.TooManyRequestsException"
],
"IntervalSeconds": 2,
"MaxAttempts": 6,
"BackoffRate": 2
}
],
"End": true
}
}
},
"MaxConcurrency": 60,
"ToleratedFailurePercentage": 10,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@esc1144 for discussion

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this will affect all/most modules, what to you think about making the value (i.e. 10%) a parameter that we set in the SF resource declaration in the modules. We would then need to collect a new parameter for it on the main template to pass along to the nested ones. But if a cx ever wanted to adjust it from the 10% default, it would easy to just run a stack update.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are several general options:

  1. All 100% Green = Everybody is happy
  2. All 100% Red = there is a totall miss in the permissions and we need to fail the full data collection step function
  3. X% are RED - most probably we do not need to fail ALL data collection as some data are collected and we need to run crawler anyway. The data will be partial, sure but there will be at least some of them. The % of failed and other interesting things we need to address in other PR in progress.

Here in the option 3 the number is not that significant. I will update it to 90% so that even 10% of success would count as success.

Again reminder that today we have all green whatever the result of SFs ;)

"ItemReader": {
"Resource": "arn:aws:states:::s3:getObject",
"ReaderConfig": {
"InputType": "JSON"
},
"Parameters": {
"Bucket.$": "$.accountLambdaOutput.Payload.bucket",
"Key.$": "$.accountLambdaOutput.Payload.accountList"
}
},
"Next": "CrawlerStepFunctionStartExecution"
},
"CrawlerStepFunctionStartExecution": {
"Type": "Task",
"Resource": "arn:aws:states:::states:startExecution.sync:2",
"Parameters": {
"StateMachineArn": "arn:aws:states:${DeployRegion}:${Account}:stateMachine:${Prefix}CrawlerExecution-StateMachine",
"Input": {
"crawlers": ${Crawlers}
}
},
"End": true
}
},
"TimeoutSeconds": 10800
}
Loading