Reputation: 133
In aws step function i need to call api gateway endpoint with path parameters from previous state values.
Step Function Code (Api Gateway Call)
"API Gateway Request": {
"Type": "Task",
"Resource": "arn:aws:states:::apigateway:invoke",
"Parameters": {
"ApiEndpoint": "****.amazonaws.com",
"Method": "GET",
"Headers": {
"Accept": [
"application/json"
]
},
"Stage": "dev",
"Path": "/sample/$.id",
"AuthType": "IAM_ROLE"
},
"InputPath": "$.id",
"Next": "Lambda Invoke",
"ResultPath": "$.myStateInput"
}
Input to this state:
{ "id": "1231" }
Instead of replacing "$.id" as "1231", it just calling url like below Api Gateway:
Please tell what i'm doing wrong ?
Upvotes: 5
Views: 1821
Reputation: 238081
Based on the comments, the solution was to use intrinsic function:
"Path.$": States.Format('/sample/{}', $.id)
State Code
"API Gateway Request": {
"Type": "Task",
"Resource": "arn:aws:states:::apigateway:invoke",
"Parameters": {
"ApiEndpoint": "**.amazonaws.com",
"Method": "GET",
"Headers": {
"Accept": [
"application/json"
]
},
"Stage": "dev",
"Path.$": "States.Format('/sample/{}', $.id)",
"AuthType": "IAM_ROLE"
},
"Next": "Lambda Invoke",
"ResultPath": "$.myStateInput"
}
Upvotes: 5