Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Enable stop protection for your EC2 instances

Focus mode
Enable stop protection for your EC2 instances - Amazon Elastic Compute Cloud
This page has not been translated into your language. Request translation

To prevent an instance from being accidentally stopped, you can enable stop protection for the instance. Stop protection also protects your instance from accidental termination.

The DisableApiStop attribute of the Amazon EC2 ModifyInstanceAttribute API controls whether the instance can be stopped by using the Amazon EC2 console, the AWS CLI, or the Amazon EC2 API. You can set the value of this attribute when you launch the instance, while the instance is running, or while the instance is stopped.

Considerations
  • Enabling stop protection does not prevent you from accidentally stopping an instance by initiating a shutdown from the instance using an operating system command such as shutdown or poweroff.

  • Enabling stop protection does not prevent AWS from stopping the instance when there is a scheduled event to stop the instance.

  • Enabling stop protection does not prevent Amazon EC2 Auto Scaling from terminating an instance when the instance is unhealthy or during scale-in events. You can control whether an Auto Scaling group can terminate a particular instance when scaling in by using instance scale-in protection.

  • Stop protection not only prevents your instance from being accidentally stopped, but also from accidental termination when using the console, AWS CLI, or API. However, it does not automatically set the DisableApiTermination attribute. Note that when the DisableApiStop attribute is set to false, the DisableApiTermination attribute setting determines whether the instance can be terminated using the console, AWS CLI, or API. For more information see Terminate Amazon EC2 instances.

  • You can't enable stop protection for instance store-backed instances.

  • You can't enable stop protection for Spot Instances.

  • The Amazon EC2 API follows an eventual consistency model when you enable or disable stop protection. This means that the result of running commands to set the stop protection attribute might not be immediately visible to all subsequent commands you run. For more information, see Eventual consistency in the Amazon EC2 Developer Guide.

Enable stop protection for an instance at launch

You can enable stop protection for an instance when launching the instance.

Console
To enable stop protection for an instance at launch
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. On the dashboard, choose Launch instance.

  3. Configure your instance in the new launch instance wizard.

  4. In the wizard, enable stop protection by choosing Enable for Stop protection under Advanced details.

AWS CLI
To enable stop protection for an instance at launch

Use the run-instances command to launch the instance. Add the following parameter.

--disable-api-stop
PowerShell
To enable stop protection for an instance at launch

Use the New-EC2Instance cmdlet to launch the instance. Add the following parameter.

-DisableApiStop $true
To enable stop protection for an instance at launch
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. On the dashboard, choose Launch instance.

  3. Configure your instance in the new launch instance wizard.

  4. In the wizard, enable stop protection by choosing Enable for Stop protection under Advanced details.

Enable stop protection for a running or stopped instance

You can enable stop protection for an instance while the instance is running or stopped.

Console
To enable stop protection for an instance
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. In the left navigation pane, choose Instances.

  3. Select the instance, and then choose Actions>Instance settings>Change stop protection.

  4. Select the Enable checkbox, and then choose Save.

AWS CLI
To enable stop protection for an instance

Use the modify-instance-attribute command.

aws ec2 modify-instance-attribute \ --instance-id i-1234567890abcdef0 \ --disable-api-stop
PowerShell
To enable stop protection for an instance

Use the Edit-EC2InstanceAttribute cmdlet.

Edit-EC2InstanceAttribute ` -InstanceId i-1234567890abcdef0 ` -DisableApiStop $true
To enable stop protection for an instance
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. In the left navigation pane, choose Instances.

  3. Select the instance, and then choose Actions>Instance settings>Change stop protection.

  4. Select the Enable checkbox, and then choose Save.

Disable stop protection for a running or stopped instance

You can disable stop protection for a running or stopped instance using one of the following methods.

Console
To disable stop protection for a running or stopped instance
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. In the left navigation pane, choose Instances.

  3. Select the instance, and then choose Actions, Instance settings, Change stop protection.

  4. Clear the Enable checkbox, and then choose Save.

AWS CLI
To disable stop protection for a running or stopped instance

Use the modify-instance-attribute command and specify the no-disable-api-stop parameter.

aws ec2 modify-instance-attribute \ --instance-id i-1234567890abcdef0 \ --no-disable-api-stop
PowerShell
To disable stop protection for an instance

Use the Edit-EC2InstanceAttribute cmdlet.

Edit-EC2InstanceAttribute ` -InstanceId i-1234567890abcdef0 ` -DisableApiStop $false
To disable stop protection for a running or stopped instance
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. In the left navigation pane, choose Instances.

  3. Select the instance, and then choose Actions, Instance settings, Change stop protection.

  4. Clear the Enable checkbox, and then choose Save.

PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.