Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "Comment": "Orchestrate Redshift Procedures",
- "StartAt": "GetObject",
- "States": {
- "GetObject": {
- "Type": "Task",
- "Next": "Batches",
- "Parameters": {
- "Bucket": "test-bucket",
- "Key": "config/orchestration.json"
- },
- "Resource": "arn:aws:states:::aws-sdk:s3:getObject",
- "ResultSelector": {
- "s3Body.$": "States.StringToJson($.Body)"
- },
- "OutputPath": "$.s3Body"
- },
- "Batches": {
- "Type": "Map",
- "ItemProcessor": {
- "ProcessorConfig": {
- "Mode": "INLINE"
- },
- "StartAt": "Procedures",
- "States": {
- "Procedures": {
- "Type": "Map",
- "ItemProcessor": {
- "ProcessorConfig": {
- "Mode": "INLINE"
- },
- "StartAt": "ExecuteStatement",
- "States": {
- "ExecuteStatement": {
- "Type": "Task",
- "Parameters": {
- "ClusterIdentifier": "test-redshift",
- "Database": "test_db",
- "Sql.$": "$.sql",
- "DbUser": "test-admin"
- },
- "Resource": "arn:aws:states:::aws-sdk:redshiftdata:executeStatement",
- "ResultPath": "$.sql_output",
- "Next": "DescribeStatement"
- },
- "DescribeStatement": {
- "Type": "Task",
- "Parameters": {
- "Id.$": "$.sql_output.Id"
- },
- "Resource": "arn:aws:states:::aws-sdk:redshiftdata:describeStatement",
- "Next": "Choice",
- "ResultPath": "$.sql_output"
- },
- "Choice": {
- "Type": "Choice",
- "Choices": [
- {
- "Variable": "$.sql_output.Status",
- "StringEquals": "FINISHED",
- "Next": "Success"
- },
- {
- "Variable": "$.sql_output.Status",
- "StringEquals": "FAILED",
- "Next": "Fail"
- },
- {
- "Variable": "$.sql_output.Status",
- "StringEquals": "ABORTED",
- "Next": "Fail"
- }
- ],
- "Default": "Wait"
- },
- "Fail": {
- "Type": "Fail"
- },
- "Success": {
- "Type": "Succeed"
- },
- "Wait": {
- "Type": "Wait",
- "Seconds": 5,
- "Next": "DescribeStatement"
- }
- }
- },
- "End": true,
- "ItemsPath": "$.procedures",
- "MaxConcurrency": 3
- }
- }
- },
- "MaxConcurrency": 1,
- "End": true,
- "ItemsPath": "$.batches"
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment