DOP-C02 Configuration Management and IaC Practice Question
Network Topology
A DevOps engineer attempted to create a CloudFormation stack and it failed. The engineer runs the 'describe-stack-events' command and sees the output above. What is the most likely cause of the failure?
⚠ Common exam trap
It's easy for candidates to confuse a missing key pair with other common EC2 launch failures like AMI unavailability or security group issues, but the specific error message in the stack events directly points to the key pair name as the root cause.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
The EC2 key pair 'myKeyPair' does not exist in the region where the stack is being created.
The 'describe-stack-events' output shows a 'CREATE_FAILED' event for the EC2 instance resource with the status reason indicating that the key pair 'myKeyPair' was not found. CloudFormation validates the existence of the specified EC2 key pair in the target region at creation time; if the key pair does not exist, the stack creation fails immediately. This is a common validation error when the key pair name is misspelled, belongs to a different region, or has not been created beforehand.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
The EC2 key pair 'myKeyPair' does not exist in the region where the stack is being created.
Why this is correct
CloudFormation validates the `KeyName` property by calling the EC2 API in the stack's target region. If `myKeyPair` has not been created in that exact region, EC2 returns an `InvalidKeyName` error and stack creation fails before any resources are provisioned. Key pairs are region-scoped, so an existing key in another region does not satisfy this validation.
- ✗
The AMI ID specified in the template is not available in the region.
Why it's wrong here
An unavailable AMI ID would cause EC2 to reject the launch with a distinct error such as `InvalidAMIID.NotFound` or a message stating the AMI ID does not exist in that region. The reported error specifically names the key pair and follows the key-name validation path, not an AMI lookup. AMI availability is region-specific, but the failure described here is unambiguously about key access rather than machine image availability.
- ✗
The CloudFormation template has a syntax error in the EC2 instance definition.
Why it's wrong here
Template syntax errors are caught during template parsing or validation, before resource creation begins, and typically produce a message such as 'Template format error' or reference a specific line/item. The error in question is an EC2-level runtime validation error that occurs while resources are being created, not a malformed template structure. A syntactically correct template still fails here because the referenced key pair does not exist in the target region.
- ✗
The security group specified for the EC2 instance does not exist.
Why it's wrong here
If a referenced security group were missing, CloudFormation would report a failure such as `InvalidGroup.NotFound` or otherwise reference the security group ID/name during instance launch. The current error message contains no security group identifier; it points directly to the key pair `myKeyPair` as the invalid attribute. Security groups are also regional, but the validation that failed here is specifically against the EC2 key-pair catalog, not a VPC or security group lookup.
Go deeper
Related to this question
About these practice questions
Courseiva writes every DOP-C02 question from scratch — 1,298 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This DOP-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DOP-C02 exam.