Exams / SOA-C03 / CloudFormation and the AWS CDK / Question 2
SOA-C03 practice question: CloudFormation and the AWS CDK (2 of 3)
Deployment, Provisioning, and Automation A free question from our original SOA-C03 practice exam. Try it, then open the answer to see why each option is right or wrong.
A ski resort's CloudFormation stack launches an EC2 instance whose user data installs and configures the ticketing application, which takes about eight minutes. The stack reports CREATE_COMPLETE about two minutes after launch, before the application is ready, and when the install script fails the stack still reports success. The team wants the stack to complete only after the application is installed, and to roll back if the install fails or takes over 15 minutes. What should a CloudOps engineer do?
Choose one answer.
- AA. Add a DependsOn attribute to the instance that names the application's security group and IAM instance profile.
- BB. Add a CreationPolicy with a 15-minute resource signal timeout to the instance, and run cfn-signal with the install script's exit status at the end of user data.
- CC. Add an UpdatePolicy attribute with a 15-minute pause time to the instance so that CloudFormation waits before marking it complete.
- DD. Add a CloudWatch alarm on the instance's status checks to the template and set the stack's rollback trigger to that alarm.
Show the answer and explanation
Answer: B
Explanation
By default CloudFormation marks an instance complete when EC2 reports it running, which says nothing about the software inside. A CreationPolicy makes CloudFormation wait for signals, and cfn-signal sends success or failure from user data. If no success signal arrives before the timeout, the resource fails and the stack rolls back.
Study
Keep practicing
Answer questions with a score at the end, or practice just this topic with the explanation after each one. No sign-up needed.