I could find many examples of invoking SQL script on Redshift using Lambda inside Step Function (ex: this works well), however I could not figured out how to execute SQL script using AWS Fargate in Step Functions. I could not figured out how to pass the Redshift credentials to execute the queries. In the lambda case it was easy as below. How to passing the credentials to Fargate Task probably is the same, however what are the commands to execute the SQL scripts?
"States": {
"loadJob": {
"Type": "Pass",
"Next": "loadJobETL",
"Result": {
"input": {
"redshift_cluster_id": "<RS_CLUSTER>",
"redshift_database": "<MY_DB>",
"redshift_user": "<MY_DB>root",
"redshift_schema": "MY_SCHEMA",
"action": "load_customer_address",
"sql_statement": [
"begin transaction;",
"MY_SQL_STATEMENT",
"end transaction;"
]
}
}
},
"loadJobETL": {
"Type": "Task",
"Resource": "arn:aws:lambda:us-east-1:XXXXXXXXXXX:function:SOME_FUNCTION",
"TimeoutSeconds": 180,
"HeartbeatSeconds": 60,
"InputPath": "$",
"ResultPath": "$",
"Next": "checkStatus"
}
}