A developer uses AWS CloudFormation to deploy an Amazon API Gateway API and an AWS Step Functions state machine. The state machine must reference the API Gateway endpoint after the template deploys. Which cost-effective CloudFormation approach allows the state machine to reference the API endpoint?
Choose an answer
Tap an option to check your answer.
Correct answer: Use the CloudFormation template's DefinitionSubstitutions property for the AWS::StepFunctions::StateMachine resource to substitute in the API endpoint..
Why this is the answer
The DefinitionSubstitutions property for AWS::StepFunctions::StateMachine allows you to define key-value pairs that CloudFormation substitutes into the state machine's ASL definition at deployment time. This is a direct and cost-effective way to inject the API Gateway endpoint, which is known only after the API Gateway resource is created, into the state machine definition. Storing the API endpoint in an environment variable for the state machine is not a standard or direct way to pass dynamic values into the ASL definition itself. Environment variables are typically for Lambda functions, not Step Functions state machine definitions. Storing the endpoint in AWS Secrets Manager or AWS AppConfig would work, but these services incur additional costs and introduce more complexity than necessary for a simple endpoint reference. DefinitionSubstitutions is designed precisely for this type of dynamic value injection into Step Functions definitions.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed