I'm trying to use the AWS provided RDS CreateSnapshot step in a Step Function/State Machine.
The Lambda function that runs immediately before it outputs a simple payload with the two properties corresponding to the two parameters required for the CreateSnapshot step. In the console, this same payload is displayed as "Step Input" for the RDS CreateSnapshot step:
{
"dbInstance": "mydb",
"dbSnapshotName": "mydb-5-21-2022--17-21"
}
The RDS CreateSnapshot is defined as:
Create-Snapshot:
Type: Task
Resource: arn:aws:states:::aws-sdk:rds:createDBSnapshot
Parameters:
DbInstanceIdentifier: $.dbInstance
DbSnapshotIdentifier: $.dbSnapshotName
Next: SNS-Finished
I get the following error:
Error
Rds.RdsException
Cause
Invalid database identifier: $.dbInstance (Service: Rds, Status Code: 400, Request ID: 18242626-0839-4e28-920e-1c6ea13c80c6)
It seems like I am missing something in my understanding of how to grab values from the input and map them to the Parameters.
CodePudding user response:
I used the new AWS Workflow Studio to bootstrap creating my pipeline; when adding the AWS provided RDS CreateSnapshot step, it sets the API parameters to be static inputs:
However, in this case, the inputs should by dynamic since they will both be provided by the preceding steps in the pipeline and passed as input to this step. The syntax for those properties needs to be adjusted accordingly in the Parameters so they could be picked up/referenced correctly.
Specifically, the Parameters for the RDS SDK API call needed ".$" appended to the end of each of them.
{
"DbInstanceIdentifier.$": "$.dbInstance",
"DbSnapshotIdentifier.$": "$.dbSnapshotName"
}