AWS Certified SysOps Administrator – Associate (legacy) — Question 487
A company is deploying a web service to Amazon EC2 instances behind an Elastic Load Balancer. All resources will be defined and created in a single AWS
CloudFormation stack using a template. The creation of each EC2 instance will not be considered complete until an initialization script has been run successfully on the EC2 instance. The Elastic Load Balancer cannot be created until all EC2 instances have been created.
Which CloudFormation resource will coordinate the Elastic Load Balancer creation in the CloudFormation stack template?
Answer options
- A. CustomResource
- B. DependsOn
- C. Init
- D. WaitCondition
Correct answer: D
Explanation
A WaitCondition resource, in conjunction with a WaitConditionHandle, allows CloudFormation to pause the creation of dependent resources like the Elastic Load Balancer until the EC2 instances signal that their initialization scripts have run successfully. While DependsOn is used to specify dependencies, it is a resource attribute rather than a resource itself. AWS::CloudFormation::Init is used for instance configuration, and CustomResource is for custom provisioning logic, making WaitCondition the correct resource for this coordination.