AWS Certified SysOps Administrator – Associate (legacy) — Question 295
A user has created a public subnet with VPC and launched an EC2 instance within it. The user is trying to delete the subnet. What will happen in this scenario?
Answer options
- A. It will delete the subnet and make the EC2 instance as a part of the default subnet
- B. It will not allow the user to delete the subnet until the instances are terminated
- C. It will delete the subnet as well as terminate the instances
- D. The subnet can never be deleted independently, but the user has to delete the VPC first
Correct answer: B
Explanation
In AWS, you cannot delete a subnet that contains active resources, including running or stopped EC2 instances. The user must first terminate any EC2 instances residing in the subnet before AWS will allow the subnet to be deleted. Options A, C, and D are incorrect because AWS does not automatically migrate or terminate instances upon subnet deletion, nor does it require deleting the entire VPC first.