Skip to content

Cannot stop or delete ec2 instance as a root user

0

there are somehow 2 ec2 instances running but not i cannot delete those instances since it throws error that the root user doesn't have permission to delete or stop an EC2 instance. I created another new instance but was able to stop them manually but somehow those 2 runnings ec2 instances cannot be deleted or modified

asked a year ago206 views

1 Answer
0

Even as a root user, you might encounter permission issues when trying to stop or delete EC2 instances. There are several possible causes and solutions for this issue:

  1. Termination Protection: Your EC2 instances might have termination protection enabled. This is a safety feature that prevents accidental termination. You'll need to disable termination protection before you can delete these instances.

  2. IAM Permissions Issue: Even though you're using the root account, there might be an IAM policy or Service Control Policy (SCP) restricting your actions, especially if your account is part of an AWS Organization.

  3. Force Stop Option: For instances stuck in the 'stopping' state:

  • In the EC2 console, select the instance
  • Choose "Instance state" and then "Force stop instance"
  • Note that this option is only available if your instance is in the 'stopping' state
  1. Missing IAM Permissions: You might need to ensure you have the proper permissions. For instance, when deleting instances, you need the ec2:TerminateInstances permission in your IAM policy.

If the instances are truly stuck and cannot be terminated through normal means, you can try:

  1. Force stopping the instance first, then attempt to terminate it
  2. If the "Force stop" option isn't available in the console, you can use the AWS CLI to force stop your instance
  3. If the instance still cannot be terminated, you may need to create a technical support case with AWS Support

If you're receiving a specific error message like "UnauthorizedOperation," you'll need to add the appropriate permissions to your IAM policy.
Sources
Delete an EC2 Fleet request and the instances in the fleet - Amazon Elastic Compute Cloud
Troubleshoot Amazon EC2 instance stop issues - Amazon Elastic Compute Cloud
How do I troubleshoot when User: arn is no authorized to perform Create * or Delete * or Update * on resource(s) because no identity- policy allows the actions | AWS re:Post
Error Virtual Cloud | AWS re:Post

answered a year ago

EXPERT

reviewed a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.