DOP-C02 Practice Question 23: CreationPolicy Resource Signal
AWS Certified DevOps Engineer – Professional (DOP-C02) · Test 3 · question 3 of 10
A deployment pipeline creates an AWS CloudFormation stack that provisions an Auto Scaling group of six Amazon EC2 instances. User data installs and configures the application, which takes about eight minutes per instance. The next pipeline stage runs integration tests against the load balancer as soon as the stack reports CREATE_COMPLETE, and those tests fail intermittently because instances are still bootstrapping. The team wants the stack to reach CREATE_COMPLETE only after at least five instances report that the application started successfully, and to roll back if that does not happen within 15 minutes.
What should the team add to the template?
Show answer and explanation
Answer:
A CreationPolicy prevents a resource from reaching create-complete "until CloudFormation receives a specified number of success signals or the timeout period is exceeded." ResourceSignal.Count sets how many signals are required and Timeout is an ISO 8601 duration, so Count: 5 and Timeout: PT15M express the requirement directly. The cfn-signal helper script sends the signal from the instance once bootstrapping finishes, and passing the script's exit code means a failed bootstrap sends a failure signal. If the signals do not arrive in time, or a failure signal arrives, resource creation fails and CloudFormation rolls the stack back, which is the second requirement.
Option B only orders resource creation. DependsOn waits for CloudFormation to consider the Auto Scaling group created, which happens as soon as the group exists, not when the software inside the instances is running. The race the team is hitting stays exactly as it is.
Option C is the right idea attached to the wrong lifecycle. UpdatePolicy with AutoScalingRollingUpdate governs how instances are replaced when the group is *updated*; it has no effect on the initial stack creation this question is about.
Option D configures Auto Scaling, not CloudFormation. The health check grace period tells the Auto Scaling group how long to wait before acting on a failing health check. CloudFormation does not watch Auto Scaling health checks, so the stack still completes while instances bootstrap.
Reference: CreationPolicy attribute