AWS Certified Developer – Associate (DVA-C02) — Question 320
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 API after the CloudFormation template is deployed. The developer needs a solution that uses the state machine to reference the API Gateway endpoint.
Which solution will meet these requirements MOST cost-effectively?
Answer options
- A. Configure the CloudFormation template to reference the API endpoint in the DefinitionSubstitutions property for the AWS::StepFunctions::StateMachine resource.
- B. Configure the CloudFormation template to store the API endpoint in an environment variable for the AWS::StepFunctions::StateMachine resource. Configure the state machine to reference the environment variable.
- C. Configure the CloudFormation template to store the API endpoint in a standard AWS::SecretsManager::Secret resource. Configure the state machine to reference the resource.
- D. Configure the CloudFormation template to store the API endpoint in a standard AWS::AppConfig::ConfigurationProfile resource. Configure the state machine to reference the resource.
Correct answer: A
Explanation
Using the DefinitionSubstitutions property in CloudFormation allows you to inject variables directly into the State Machine definition at deployment time, which is completely free and highly efficient. AWS Step Functions does not support native environment variables, making option B invalid. Options C and D are incorrect because utilizing AWS Secrets Manager or AWS AppConfig introduces ongoing storage and retrieval costs, making them less cost-effective.