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?
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.
Why this answer
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.
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.
How to eliminate wrong answers
Option A is wrong because AWS Config rules are reactive and can only detect and remediate non-compliant resources after the fact; they cannot prevent the deletion from occurring in the first place, and automatically recreating a VPC does not meet the requirement to restrict deletion. Option C is wrong because an SCP that denies ec2:DeleteVpc for all VPCs would also prevent developers from deleting their own VPCs, which is overly restrictive and does not allow developers to manage their own VPCs as required. Option D is wrong because an IAM policy that denies ec2:DeleteVpc unless the VPC has a specific tag can be circumvented if developers add that tag to centrally created VPCs before deleting them, and it does not provide a reliable mechanism to distinguish centrally created VPCs from developer-created VPCs.