From 37e2503981717ffc8076925a556533ac346b4d7c Mon Sep 17 00:00:00 2001 From: Alex Thewsey Date: Wed, 23 Nov 2022 09:58:29 +0800 Subject: [PATCH] feat: Enable using MLOps guidance in nested stack Expose useful outputs from MLOps solution guidance stack to enable nesting it inside other CloudFormation templates to trigger and chain the workflows it creates. Shorten role name that was causing problems when nesting the stack. Explicitly set string types to ambiguous bool parameters (YAML interprets plain true as a bool, not string, and in one instance I got errors during CFn deployment complaining about string types). Fill in a placeholder SFn description. --- ml_ops/forecast-mlops-dependency.yaml | 12 +++--- ml_ops/forecast-mlops-solution-guidance.yaml | 45 +++++++++++++++----- 2 files changed, 41 insertions(+), 16 deletions(-) diff --git a/ml_ops/forecast-mlops-dependency.yaml b/ml_ops/forecast-mlops-dependency.yaml index e7d829f..3a88972 100644 --- a/ml_ops/forecast-mlops-dependency.yaml +++ b/ml_ops/forecast-mlops-dependency.yaml @@ -12,17 +12,17 @@ Parameters: ExistingS3Bucket: Description: Does your S3 bucket already exist? - Default: false + Default: 'false' Type: String AllowedValues: - - true - - false + - 'true' + - 'false' ConstraintDescription: must specify true or false Conditions: - CreateS3Resource: !Equals + CreateS3Resource: !Equals - !Ref ExistingS3Bucket - - false + - 'false' Resources: @@ -679,4 +679,4 @@ Resources: - !Sub 'arn:aws:ssm:*:${AWS::AccountId}:parameter/forecast/*' Version: '2012-10-17' PolicyName: !Sub '${AWS::StackName}-ssm-ops' - RoleName: !Sub 'ForecastStepFunctionExecutionRole' \ No newline at end of file + RoleName: !Sub 'ForecastStepFunctionExecutionRole' diff --git a/ml_ops/forecast-mlops-solution-guidance.yaml b/ml_ops/forecast-mlops-solution-guidance.yaml index 2cb3b1b..967a88c 100644 --- a/ml_ops/forecast-mlops-solution-guidance.yaml +++ b/ml_ops/forecast-mlops-solution-guidance.yaml @@ -7,20 +7,20 @@ Parameters: DatasetIncludeRTS: Description: Do you wish to provide a related time series (RTS) for this use-case? - Default: true + Default: 'true' Type: String AllowedValues: - - true - - false + - 'true' + - 'false' ConstraintDescription: must specify true or false DatasetIncludeItem: Description: Do you wish to provide item metadata for this use-case? - Default: true + Default: 'true' Type: String AllowedValues: - - true - - false + - 'true' + - 'false' ConstraintDescription: must specify true or false DatasetGroupName: @@ -322,7 +322,7 @@ Resources: - states:StopExecution Effect: Allow Resource: - - !Join + - !Join - '' - - !Sub 'arn:aws:states:${AWS::Region}:${AWS::AccountId}:stateMachine:${AWS::StackName}' - '*' @@ -339,7 +339,6 @@ Resources: - !Sub 'arn:aws:events:${AWS::Region}:${AWS::AccountId}:rule/StepFunctionsGetEventsForStepFunctionsExecutionRule' Version: '2012-10-17' PolicyName: !Sub '${AWS::StackName}-events-ops' - RoleName: !Sub "StepFunctions-${AWS::StackName}-Workflow-Role" CreateDatasetGroupStateMachine: @@ -1747,7 +1746,7 @@ Resources: DefinitionString: !Sub | { - "Comment": "A description of my state machine", + "Comment": "An automation pipeline to query forecasting input data from Amazon Athena", "StartAt": "GetParameters", "States": { "GetParameters": { @@ -2199,4 +2198,30 @@ Resources: } } - RoleArn: !Sub "arn:aws:iam::${AWS::AccountId}:role/StepFunctions-${AWS::StackName}-Workflow-Role" + RoleArn: !GetAtt StepFunctionsWorkflowRole.Arn + +Outputs: + CreateDatasetGroupStateMachineArn: + Description: ARN of the AWS Step Functions State Machine to create the Amazon Forecast dataset group + Value: !Ref CreateDatasetGroupStateMachine + AthenaConnectorStateMachineArn: + Description: ARN of the AWS Step Functions State Machine to query data from Amazon Athena + Value: !Ref AthenaConnectorStateMachine + DatasetImportStateMachineArn: + Description: ARN of the AWS Step Functions State Machine to import data to Amazon Forecast + Value: !Ref CreateImportDatasetStateMachine + CreatePredictorStateMachineArn: + Description: ARN of the AWS Step Functions State Machine to train an Amazon Forecast predictor + Value: !Ref CreatePredictorStateMachine + CreateForecastStateMachineArn: + Description: ARN of the AWS Step Functions State Machine to generate a forecast + Value: !Ref CreateForecastStateMachine + StepFunctionWorkflowStateMachineArn: + Description: ARN of the AWS Step Functions State Machine for end-to-end flow from Athena to forecast output + Value: !Ref StepFunctionWorkflowStateMachine + StepFunctionsWorkflowRoleArn: + Description: ARN of the IAM Execution Role used for the End-to-end forecasting Step Functions workflow + Value: !GetAtt StepFunctionsWorkflowRole.Arn + StackName: + Description: (Output to expose the StackName when nesting this stack inside others) This is used for naming some useful resources + Value: !Ref AWS::StackName