DOP-C02 Configuration Management and IaC Practice Question
This DOP-C02 practice question tests your understanding of configuration management and iac. Match the stated requirement to the specific cloud service, access model, or configuration option — many options are valid in isolation but not for this scenario. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.
A DevOps engineer creates the CloudFormation template shown in the exhibit. When the stack is created, the EC2 instance is launched but the security group is not applied to the instance. What is the likely cause?
The security group resource is missing a VpcId property, so it is not created in the same VPC as the instance.
Why wrong: B: The security group will be created in the default VPC if VpcId is not specified, but the instance also goes to the default VPC, so that is not the issue.
B
The instance does not have a SecurityGroup or SecurityGroupIds property referencing the security group.
D: The instance properties must include SecurityGroupIds or SecurityGroups to attach the group; DependsOn only controls creation order.
C
The security group is created after the instance, so the instance cannot reference it.
Why wrong: C: DependsOn ensures the security group is created first.
D
The DependsOn clause should be removed because it causes a circular dependency.
Why wrong: A: There is no circular dependency; DependsOn is used correctly but does not attach the group.
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
The instance does not have a SecurityGroup or SecurityGroupIds property referencing the security group.
Option B is correct because the CloudFormation template does not include a `SecurityGroup` or `SecurityGroupIds` property in the EC2 instance's `AWS::EC2::Instance` resource. Without this explicit reference, the instance launches with the default VPC security group, not the custom security group defined in the template. The security group resource is created successfully, but it is not attached to the instance.
Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
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 security group resource is missing a VpcId property, so it is not created in the same VPC as the instance.
Why it's wrong here
B: The security group will be created in the default VPC if VpcId is not specified, but the instance also goes to the default VPC, so that is not the issue.
✓
The instance does not have a SecurityGroup or SecurityGroupIds property referencing the security group.
Why this is correct
D: The instance properties must include SecurityGroupIds or SecurityGroups to attach the group; DependsOn only controls creation order.
Related concept
Read the scenario before looking for a memorised answer.
✗
The security group is created after the instance, so the instance cannot reference it.
Why it's wrong here
C: DependsOn ensures the security group is created first.
✗
The DependsOn clause should be removed because it causes a circular dependency.
Why it's wrong here
A: There is no circular dependency; DependsOn is used correctly but does not attach the group.
Common exam traps
Common exam trap: answer the scenario, not the keyword
The trap here is that candidates assume creating a security group resource in the template automatically applies it to the instance, but CloudFormation requires an explicit attachment via the instance's security group properties.
Detailed technical explanation
How to think about this question
In CloudFormation, when you define an EC2 instance without a `SecurityGroup` or `SecurityGroupIds` property, the instance is launched into the default VPC's default security group, which allows all traffic by default. To attach a custom security group, you must explicitly reference it using `!Ref SecurityGroupLogicalId` in the instance's `SecurityGroupIds` property (a list) or the legacy `SecurityGroup` property (a single group). The `DependsOn` clause is only needed when there is no implicit reference; here, a `!Ref` creates an implicit dependency, so `DependsOn` is redundant but harmless.
KKey Concepts to Remember
Read the scenario before looking for a memorised answer.
Find the constraint that changes the correct option.
Eliminate answers that are true in general but not in this case.
TExam Day Tips
→Watch for words such as best, first, most likely and least administrative effort.
→Review why wrong options are wrong, not only why the correct option is correct.
Key takeaway
Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Real-world example
How this comes up in practice
A healthcare organisation deploys an application with a public-facing web tier and a private database tier. The database subnet has no public IP and only accepts connections from the web tier's security group. Questions like this test whether you can design cloud network isolation using VNets/VPCs, subnets, and security group rules.
What to study next
Got this wrong? Here's your next step.
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
Configuration Management and IaC — This question tests Configuration Management and IaC — Read the scenario before looking for a memorised answer..
What is the correct answer to this question?
The correct answer is: The instance does not have a SecurityGroup or SecurityGroupIds property referencing the security group. — Option B is correct because the CloudFormation template does not include a `SecurityGroup` or `SecurityGroupIds` property in the EC2 instance's `AWS::EC2::Instance` resource. Without this explicit reference, the instance launches with the default VPC security group, not the custom security group defined in the template. The security group resource is created successfully, but it is not attached to the instance.
What should I do if I get this DOP-C02 question wrong?
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
What is the key concept behind this question?
Read the scenario before looking for a memorised answer.
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
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.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.