SAP-C02 IAM Policy with Condition Keys Practice Question
A company uses AWS Organizations with multiple OUs. The DevOps team wants to allow developers in a specific OU to create and manage their own VPCs but restrict them from deleting VPCs created by the central networking team. How can this be achieved?
⚠ Common exam trap
The key trap is that candidates often think resource-based policies (Option B) can be applied to VPCs, but VPCs do not support them. Instead, tag-based conditions in IAM policies or SCPs are the correct mechanisms for selective denial.
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
✓
Create an IAM policy for developers that denies ec2:DeleteVpc unless the VPC has a specific tag.
VPCs do not support resource-based policies (making Option B invalid). An IAM policy with a condition based on a tag can effectively restrict deletion. For example, developers can be allowed to delete VPCs only if the VPC has a specific tag (e.g., 'AllowDeletion: true'), which they can add to their own VPCs. Centrally created VPCs would lack this tag, so deletion is denied. This provides granular control without affecting other permissions.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Use AWS Config rules to automatically recreate any VPC that is deleted.
Why it's wrong here
Incorrect. AWS Config rules can detect and remediate noncompliant resources, but they are reactive and cannot prevent deletion. Additionally, automatically recreating deleted VPCs could lead to resource conflicts and is not a secure access control mechanism.
- ✗
Use a resource-based policy on each centrally created VPC to deny ec2:DeleteVpc to the developers' roles.
Why it's wrong here
Incorrect. VPCs do not support resource-based policies. The AWS documentation states that you cannot attach a resource-based policy to a VPC. Therefore, this option is not feasible.
- ✗
Create an SCP for the developers' OU that denies ec2:DeleteVpc for all VPCs.
Why it's wrong here
Incorrect. An SCP applied to the developers' OU would deny ec2:DeleteVpc for all VPCs in all accounts within that OU, including VPCs created by developers themselves, which is too restrictive and not the intended solution.
- ✓
Create an IAM policy for developers that denies ec2:DeleteVpc unless the VPC has a specific tag.
Why this is correct
Correct. An IAM policy with a condition key (e.g., based on a tag) can allow or deny the ec2:DeleteVpc action selectively. Developers can delete only VPCs that have a specific tag, while centrally created VPCs without that tag are protected from deletion.
Go deeper
Related to this question
About these practice questions
One of 1,660 original SAP-C02 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This SAP-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 SAP-C02 exam.