Can’t terminate EC2 instance? We can help you resolve it.
As a part of our AWS Support Services, we often receive similar requests from our AWS customers.
Today, let’s see the steps followed by our Support Techs to help our customers.
Can’t terminate EC2 instance
Below are some of the reasons for instance might not terminate.
- Firstly, the instance is in the stopping or pending state.
- Termination protection is enabled on the instance.
- There are incorrect permissions on the AWS Identity and Access Management (IAM) policy attached to the role or user attempting to terminate the instance.
Today, let us see the steps followed by our Support Techs to troubleshoot it.
The instance is in the stopping or pending state
If the instance appears “stuck” in the stopping state, see Troubleshooting stopping your instance.
After you have successfully stopped the instance, you can terminate it.
If the instance remains in the pending state for more than 30 minutes after you attempt to launch it, then run the stop or terminate command from the AWS Command Line Interface (AWS CLI).
To assist with troubleshooting, enable the –debug option.
Please note if you receive errors when running AWS CLI commands, make sure that you’re using the most recent version of the AWS CLI.
Termination protection is enabled on the instance
If termination protection is enable, you can’t terminate the instance.
To enable termination protection for an instance at launch time
- Firstly, open the Amazon EC2 console.
- On the dashboard, choose Launch Instance and follow the directions in the wizard.
- Then on the Configure Instance Details page, select the Enable termination protection check box.
To enable termination protection for a running or stopped instance
- Select the instance, and choose Actions, Instance Settings, Change Termination Protection.
- Then choose Yes, Enable.
To disable termination protection for a running or stopped instance
- Select the instance, and choose Actions, Instance Settings, Change Termination Protection.
- Finally choose Yes, Disable.
There are incorrect permissions on the IAM policy attached to the role or user attempting to terminate the instance.
The IAM policy attached to the role or user attempting to terminate the instance must allow the ec2:TerminateInstances API.
For information on editing IAM policies, see Editing IAM policies.
[Need help with more AWS queries? We’d be happy to assist]
Conclusion
To conclude, today we discussed the steps followed by our Support Engineers when you can’t terminate EC2 instance.
0 Comments