DVA-C02 · Question #319
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
The correct answer is A. Configure the CloudFormation template to reference the API endpoint in the. Option A is correct because CloudFormation's built-in intrinsic functions (such as !Sub or !GetAtt) can directly embed the API Gateway endpoint URL into the Step Functions state machine definition at deployment time - this costs nothing beyond what CloudFormation already does and
Question
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?
Options
- AConfigure the CloudFormation template to reference the API endpoint in the
- BConfigure the CloudFormation template to store the API endpoint in an environment variable for
- CConfigure the CloudFormation template to store the API endpoint in a standard
- DConfigure the CloudFormation template to store the API endpoint in a standard
How the community answered
(42 responses)- A71% (30)
- B2% (1)
- C17% (7)
- D10% (4)
Explanation
Option A is correct because CloudFormation's built-in intrinsic functions (such as !Sub or !GetAtt) can directly embed the API Gateway endpoint URL into the Step Functions state machine definition at deployment time - this costs nothing beyond what CloudFormation already does and requires no additional services. Option B is wrong because environment variables belong to compute resources like Lambda, not Step Functions state machines, making it an indirect and architecturally awkward workaround. Options C and D both involve storing the endpoint in AWS Systems Manager Parameter Store or AWS Secrets Manager, which introduces unnecessary operational overhead and potential costs (especially Secrets Manager, which charges per secret per month) for data that is neither secret nor dynamic - it's simply a deployment output.
Memory tip: When CloudFormation resources need to share values within the same stack, always reach for intrinsic functions (!Ref, !GetAtt, !Sub) first - they're free, native, and deploy-time resolved. Only reach for Parameter Store or Secrets Manager when values need to be shared across stacks or accessed outside of CloudFormation.
Topics
Community Discussion
No community discussion yet for this question.