docs.aws.amazon.com
Open in
urlscan Pro
18.66.147.76
Public Scan
URL:
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Stop_Start.html
Submission: On August 22 via api from US — Scanned from DE
Submission: On August 22 via api from US — Scanned from DE
Form analysis
0 forms found in the DOMText Content
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 click “Customize cookies” 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 continue without accepting these cookies, click “Continue without accepting.” To make more detailed choices or learn more, click “Customize cookies.” Accept all cookiesContinue without acceptingCustomize cookies CUSTOMIZE COOKIE PREFERENCES We use cookies and similar tools (collectively, "cookies") for the following purposes. ESSENTIAL Essential cookies are necessary to provide our site and services and cannot be deactivated. They are usually set in response to your actions on the site, such as setting your privacy preferences, signing in, or filling in forms. PERFORMANCE Performance cookies provide anonymous statistics about how customers navigate our site so we can improve site experience and performance. Approved third parties may perform analytics on our behalf, but they cannot use the data for their own purposes. Allow performance category Allowed FUNCTIONAL Functional cookies help us provide useful site features, remember your preferences, and display relevant content. Approved third parties may set these cookies to provide certain site features. If you do not allow these cookies, then some or all of these services may not function properly. Allow functional category Allowed ADVERTISING Advertising cookies may be set through our site by us or our advertising partners and help us deliver relevant marketing content. If you do not allow these cookies, you will experience less relevant advertising. Allow advertising category Allowed Blocking some types of cookies may impact your experience of our sites. You may review and change your choices at any time by clicking Cookie preferences in the footer of this site. We and selected third-parties use cookies or similar technologies as specified in the AWS Cookie Notice. CancelSave preferences UNABLE TO SAVE COOKIE PREFERENCES We will only store essential cookies at this time, because we were unable to save your cookie preferences. If you want to change your cookie preferences, try again later using the link in the AWS console footer, or contact support if the problem persists. Dismiss Contact Us English Create an AWS Account 1. AWS 2. ... 3. Documentation 4. Amazon EC2 5. User Guide for Linux Instances Feedback Preferences AMAZON ELASTIC COMPUTE CLOUD USER GUIDE FOR LINUX INSTANCES * What is Amazon EC2? * Set up * Get started tutorial * Best practices * Working with AWS SDKs * Tutorials * Install LAMP * Amazon Linux 2023 * Amazon Linux 2 * Amazon Linux * Configure SSL/TLS * Amazon Linux 2023 * Amazon Linux 2 * Amazon Linux * Host a WordPress blog * Amazon Linux 2023 * Amazon Linux 2 * Increase size of Amazon EBS volume * Step 1: Launch an instance with added volume * Step 2: Make the data volume available for use * Step 3: Increase the size of the data volume * Step 4: Extend the file system * Step 5: Clean up * Amazon Machine Images * AMI types * Virtualization types * Boot modes * Launch an instance * AMI boot mode parameter * Instance type boot mode * Instance boot mode * Operating system boot mode * Set AMI boot mode * UEFI variables * UEFI Secure Boot * How UEFI Secure Boot works * Launch an instance with UEFI Secure Boot support * Verify whether an instance is enabled for UEFI Secure Boot * Create a Linux AMI to support UEFI Secure Boot * Create three key pairs * Option A: Add keys to the variable store from within the instance * Option B: Create a binary blob containing a pre-filled variable store * How the AWS binary blob is created * Find a Linux AMI * Shared AMIs * Find shared AMIs * Make an AMI public * Share an AMI with organizations or OUs * Share an AMI with specific AWS accounts * Cancel having an AMI shared with your account * Use bookmarks * Guidelines for shared Linux AMIs * Paid AMIs * AMI lifecycle * Create an AMI * Create an Amazon EBS-backed Linux AMI * Create an instance store-backed Linux AMI * Set up the AMI tools * Create an AMI from an instance store-backed instance * Convert to an Amazon EBS-Backed AMI * AMI tools reference * Modify an AMI * Copy an AMI * Store and restore an AMI * Deprecate an AMI * Deregister your AMI * Recover AMIs from the Recycle Bin * Automate the EBS-backed AMI lifecycle * Use encryption with EBS-backed AMIs * Monitor AMI events * Understand AMI billing * AMI billing fields * Find AMI billing information * Verify AMI charges on your bill * Amazon Linux * Run Amazon Linux 2 on premises * Kernel Live Patching * User provided kernels * Configure the MATE desktop connection * AMI quotas * Instances * Instances and AMIs * Instance types * General purpose * Burstable performance instances * Key concepts * Unlimited mode * Concepts * Examples * Standard mode * Concepts * Examples * Work with burstable performance instances * Monitor your CPU credits * Compute optimized * Memory optimized * Storage optimized * Accelerated computing * Install NVIDIA drivers * Install AMD drivers * Dual 4k on G4ad * Activate NVIDIA GRID Virtual Applications * Optimize GPU settings * Find an instance type * Get recommendations * Change the instance type * Compatibility * Troubleshoot * Instance store-backed instances * Mac instances * Instance purchasing options * On-Demand Instances * Reserved Instances * Regional and zonal Reserved Instances (scope) * Types of Reserved Instances (offering classes) * How Reserved Instances are applied * Use your Reserved Instances * How you are billed * Buy Reserved Instances * Sell in the Reserved Instance Marketplace * Modify Reserved Instances * Exchange Convertible Reserved Instances * Reserved Instance quotas * Spot Instances * Best practices * How Spot Instances work * Spot Instance pricing history * Savings * Work with Spot Instances * Example launch specifications * Spot request status * Rebalance recommendations * Spot Instance interruptions * Reasons for interruption * Interruption behavior * Stop * Hibernate * Terminate * Prepare for interruptions * Initiate a Spot Instance interruption * Spot Instance interruption notices * Find interrupted Spot Instances * Determine whether Amazon EC2 terminated a Spot Instance * Billing * Spot placement score * Spot Instance data feed * Spot Instance quotas * Burstable performance instances * Dedicated Hosts * Pricing and billing * Burstable T3 instances on Dedicated Hosts * Work with Dedicated Hosts * Work with shared Dedicated Hosts * Dedicated Hosts on AWS Outposts * Host recovery * Host maintenance * Track configuration changes * Dedicated Instances * Work with Dedicated Instances * On-Demand Capacity Reservations * Capacity Reservation pricing and billing * Work with Capacity Reservations * Work with Capacity Reservation groups * Capacity Reservations in cluster placement groups * Capacity Reservations in Local Zones * Capacity Reservations in Wavelength Zones * Capacity Reservations on AWS Outposts * Work with shared Capacity Reservations * Capacity Reservation Fleets * Capacity Reservation Fleet concepts * Work with Capacity Reservation Fleets * Example configurations * Using service-linked roles * Monitoring Capacity Reservations * CloudWatch metrics * EventBridge events * Utilization notifications * Instance lifecycle * Launch * Launch using the launch instance wizard * Old launch instance wizard * Launch using a launch template * Restrictions * Control launching instances * Create * Modify (manage versions) * Delete * Launch instances * Launch an instance from an existing instance * Use an AWS Marketplace instance * Stop and start * Hibernate * Overview * Prerequisites * Limitations * Configure an AMI to support hibernation * Enable hibernation for an instance * Disable KASLR on an instance (Ubuntu only) * Hibernate an instance * Start a hibernated instance * Troubleshoot * Reboot * Retire * Terminate * Recover * Connect * Connect to your Linux instance * Connect with SSH from Linux or macOS * Connect from Windows * Connect with OpenSSH (Recommended) * Connect with PuTTY * Connect with WSL * Connect with EC2 Instance Connect * Prerequisites * Permissions * Install EC2 Instance Connect * Connect using EC2 Instance Connect * Uninstall EC2 Instance Connect * Connect with Session Manager * Connect with CloudShell * Connect to instances without requiring a public IPv4 address * Permissions * Security groups * Create an EC2 Instance Connect Endpoint * Connect to an instance * Log connections * Remove EC2 Instance Connect Endpoint * Service-linked role * Quotas * Connect your instance to a resource * Tutorial: Connect an EC2 instance to an RDS database * Option 1: Automatically connect – EC2 console * Task 1: Create an RDS database – optional * Task 2: Launch an EC2 instance – optional * Task 3: Automatically connect your EC2 instance to your RDS database * Task 4: Verify the connection configuration * Option 2: Automatically connect – RDS console * Task 1: Launch an EC2 instance – optional * Task 2: Create an RDS database and automatically connect it to your EC2 instance * Task 3: Verify the connection configuration * Option 3: Manually connect (create security groups) * Task 1: Launch an EC2 instance – optional * Task 2: Create an RDS database – optional * Task 3: Manually connect your EC2 instance to your RDS database * Clean up * Configure instances * Manage software * Update software * Add repositories * Find and install software packages * Prepare to compile software * Manage users * Processor state control * I/O scheduler * Set the time * Optimize CPU options * Rules for specifying CPU options * CPU cores and threads per CPU core per instance type * Specify CPU options for your instance * View the CPU options for your instance * CPU features * AMD SEV-SNP * Requirements * Considerations * Concepts and terminology * Working with AMD SEV-SNP * Attestation with AMD SEV-SNP * Change the hostname * Set up dynamic DNS * Run commands at launch * Instance metadata and user data * Use IMDSv2 * How IMDSv2 works * Transition to using IMDSv2 * Supported SDKs * Configure the instance metadata options * For new instances * For existing instances * Retrieve instance metadata * Work with instance user data * Retrieve dynamic data * Instance metadata categories * Example: AMI launch index value * Instance identity documents * Verify using the PKCS7 signature * Verify using the base64-encoded signature * Verify using the RSA-2048 signature * Instance identity roles * Amazon EI * Identify instances * Fleets * EC2 Fleet * EC2 Fleet request types * EC2 Fleet 'instant' type * EC2 Fleet configuration strategies * Plan an EC2 Fleet * Allocation strategies for Spot Instances * Attribute-based instance type selection * On-Demand backup * Capacity Rebalancing * Maximum price overrides * Control spending * Instance weighting * Work with EC2 Fleets * Spot Fleet * Spot Fleet request types * Spot Fleet configuration strategies * Plan a Spot Fleet request * Allocation strategies for Spot Instances * Attribute-based instance type selection * On-Demand in Spot Fleet * Capacity Rebalancing * Spot price overrides * Control spending * Instance weighting * Work with Spot Fleets * CloudWatch metrics for Spot Fleet * Automatic scaling for Spot Fleet * Target tracking scaling policies * Step scaling policies * Scheduled scaling * Monitor fleet events * EC2 Fleet event types * Spot Fleet event types * Create EventBridge rules * For EC2 Fleet events * For Spot Fleet events * Tutorials * Tutorial: Use EC2 Fleet with instance weighting * Tutorial: Use EC2 Fleet with On-Demand as the primary capacity * Tutorial: Launch On-Demand Instances using targeted Capacity Reservations * Tutorial: Use Spot Fleet with instance weighting * Example configurations * EC2 Fleet example configurations * Spot Fleet example configurations * Fleet quotas * Monitor * Automated and manual monitoring * Best practices for monitoring * Monitor the status of your instances * Instance status checks * State change events * Scheduled events * Define event windows for scheduled events * Monitor your instances using CloudWatch * Enable detailed monitoring * List available metrics * Get statistics for metrics * Get statistics for a specific instance * Aggregate statistics across instances * Aggregate statistics by Auto Scaling group * Aggregate statistics by AMI * Graph metrics * Create an alarm * Create alarms that stop, terminate, reboot, or recover an instance * Automate using EventBridge * Monitor memory and disk metrics * Deprecated: Collect metrics using the CloudWatch monitoring scripts * Log API calls with AWS CloudTrail * Networking * Regions and Zones * Instance IP addressing * Multiple IP addresses * Instance hostname types * Bring your own IP addresses * Elastic IP addresses * Network interfaces * Best practices for configuring network interfaces * Scenarios for network interfaces * Requester-managed network interfaces * Assign prefixes * Work with prefixes * Network bandwidth * Enhanced networking * Elastic Network Adapter (ENA) * ENA Express * Intel 82599 VF * Operating system optimizations * Network performance metrics * Troubleshoot ENA * Improve network latency on Linux instances * Elastic Fabric Adapter * Get started with EFA and MPI * Get started with EFA and NCCL * Use a base AMI * Use an AWS Deep Learning AMI * Work with EFA * Monitor an EFA * Verify the EFA installer using a checksum * Placement groups * Share a placement group * Placement groups on AWS Outposts * Network MTU * Virtual private clouds * Code examples * Actions * Add tags to resources * Allocate an Elastic IP address * Associate an Elastic IP address with an instance * Create a security group * Create a security key pair * Create and run an instance * Delete a security group * Delete a security key pair * Delete a snapshot * Describe Availability Zones * Describe Regions * Describe instance status * Describe instances * Describe snapshots * Disable detailed monitoring * Disassociate an Elastic IP address from an instance * Enable monitoring * Get data about Amazon Machine Images * Get data about a security group * Get data about instance types * Get details about Elastic IP addresses * List security key pairs * Reboot an instance * Release an Elastic IP address * Set inbound rules for a security group * Start an instance * Stop an instance * Terminate an instance * Scenarios * Get started with instances * Security * Infrastructure security * Resilience * Data protection * Identity and access management * IAM policies * Policy structure * Tag resources during creation * Control access to EC2 resources using resource tags * Example policies for CLI or SDK * Example policies for the console * AWS managed policies * IAM roles * Network access * Key pairs * Create key pairs * Tag a public key * Describe public keys * Delete a public key * Add or remove a public key on your instance * Verify the fingerprint * Security groups * Security group rules * Connection tracking * Default and custom security groups * Work with security groups * Security group rules for different use cases * AWS PrivateLink * Update management * Compliance validation * NitroTPM * Considerations * Prerequisites * Create a Linux AMI for NitroTPM support * Verify whether an AMI is enabled for NitroTPM * Enable or stop using NitroTPM on an instance * Storage * Amazon EBS * EBS volumes * EBS volume types * General Purpose SSD volumes * Provisioned IOPS SSD volumes * Throughput Optimized HDD and Cold HDD volumes * Size and configuration constraints * Create a volume * Attach a volume to an instance * Attach a volume to multiple instances * Make a volume available for use * View volume details * Replace a volume * Replace a root volume * Monitor the status of your volumes * Detach a volume from an instance * Delete a volume * Fault testing * EBS snapshots * Create snapshots * Delete a snapshot * Copy a snapshot * Archive snapshots * Guidelines and best practices for archiving snapshots * Required IAM permissions * Work with snapshot archiving * Monitor snapshot archiving * View snapshot information * Share a snapshot * Recover snapshots from the Recycle Bin * Local snapshots on Outposts * Amazon EBS direct APIs * IAM permissions for EBS direct APIs * Use EBS direct APIs * Read snapshots * Write snapshots * Use encryption * Use Signature Version 4 signing * Use checksums * Idempotency for StartSnapshot API * Error retries * Optimize performance * EBS direct APIs service endpoints * Interface VPC endpoints * Log API calls with AWS CloudTrail * Frequently asked questions * Automate the snapshot lifecycle * Amazon Data Lifecycle Manager * Automate snapshot lifecycles * Automate AMI lifecycles * Automate cross-account snapshot copies * View, modify, and delete lifecycle policies * AWS Identity and Access Management * AWS managed policies * IAM service roles * Permissions for users * Permissions for encryption * Monitor the lifecycle of snapshots and AMIs * Monitor your policies using CloudWatch Events * Monitor your policies using Amazon CloudWatch * EBS data services * Elastic volumes * Requirements * Request volume modifications * Monitor modifications * Extend a file system * EBS encryption * Fast snapshot restore * EBS volumes and NVMe * EBS optimization * EBS performance * I/O characteristics and monitoring * Initialize volumes * RAID configuration * Benchmark EBS volumes * EBS CloudWatch metrics * EBS EventBridge events * EBS quotas * Instance store * Instance store volumes * Add instance store volumes * SSD instance store volumes * Instance store swap volumes * Optimize disk performance * File storage * Amazon S3 * Amazon EFS * Amazon FSx * Instance volume limits * Root device volume * Device names * Block device mappings * Torn write prevention * Resources and tags * Recycle Bin * Considerations * Required IAM permissions * Condition keys for Recycle Bin * Work with retention rules * Work with resources in the Recycle Bin * Monitor Recycle Bin * Monitor using EventBridge * Monitor using CloudTrail * Resource locations * Resource IDs * List and filter your resources * Tag your resources * Service quotas * Usage reports * Troubleshoot * Troubleshoot launch issues * Connect to your instance * Stop your instance * Terminate your instance * Failed status checks * Troubleshoot an unreachable instance * Boot from the wrong volume * EC2Rescue for Linux * Install EC2Rescue for Linux * (Optional) Verify the signature of EC2Rescue for Linux * Work with EC2Rescue for Linux * Develop EC2Rescue modules * EC2 Serial Console * Prerequisites * Configure access to the EC2 Serial Console * Connect to the EC2 Serial Console * Disconnect from the EC2 Serial Console * Troubleshoot your instance using the EC2 Serial Console * Troubleshoot your Linux instance using GRUB * Troubleshoot your Linux instance using SysRq * Send a diagnostic interrupt * Related information * Document history Stop and start your instance - Amazon Elastic Compute Cloud AWSDocumentationAmazon EC2User Guide for Linux Instances Related costsFind running and stopped instancesPrerequisitesManually stop and startAutomatically stop and start What happens when you stop an instanceWhat happens when you start an instanceModify a stopped instanceEnable stop protectionTest application responseTroubleshooting STOP AND START YOUR INSTANCE PDFRSS You can stop and start your instance if it has an Amazon EBS volume as its root device. The instance retains its instance ID, but can be modified as described in the Modify a stopped instance section. When you stop an instance, the instance shuts down. When you start an instance, the instance is typically migrated to a new underlying host computer and assigned a new public IPv4 address. When you stop an instance, it is not deleted. If you decide that you no longer need an instance, you can terminate it. For more information, see Terminate your instance. If you want to hibernate an instance to save the contents from the instance memory (RAM), see Hibernate your On-Demand Linux instance. For distinctions between instance lifecycle actions, see Differences between reboot, stop, hibernate, and terminate. AWS can schedule events for your instances, such as reboot, stop/start, or retirement. For information about the type of scheduled events that are managed by AWS, and how to view and receive notifications about scheduled events, see Scheduled events for your instances. The following diagram shows what is lost and what persists when an Amazon EC2 instance is stopped. When an instance stops, it loses any attached instance store volumes and the data stored on those volumes, the data stored on the instance RAM, and the assigned public IPv4 address if an Elastic IP address is not associated with the instance. An instance retains assigned private IPv4 addresses, Elastic IP addresses associated with the instance, any IPv6 addresses, and any attached Amazon EBS volumes and the data on those volumes. TOPICS * Related costs * Find running and stopped instances * Prerequisites * Manually stop and start * Automatically stop and start * What happens when you stop an instance * What happens when you start an instance * Modify a stopped instance * Enable stop protection * Test application response * Troubleshooting COSTS RELATED TO STARTING AND STOPPING AN INSTANCE The following costs are associated with stopping and starting an instance. Stopping — As soon as the state of an instance changes to shutting-down or terminated, charges are no longer incurred for the instance. You are not charged for usage or data transfer fees for a stopped instance. Charges are incurred to store Amazon EBS storage volumes. Starting — Each time you start a stopped instance, you are charged for a minimum of one minute of usage. After one minute, you are charged for only the seconds you use. For example, if you run an instance for 20 seconds and then stop it, you are charged for a minute of usage. If you run an instance for 3 minutes and 40 seconds, you are charged for 3 minutes and 40 seconds of usage. FIND ALL RUNNING AND STOPPED INSTANCES You can find all of your running and stopped instances across all AWS Regions on a single page using Amazon EC2 Global View. This capability is especially useful for taking inventory and finding forgotten instances. For information about how to use Global View, see List and filter resources across Regions using Amazon EC2 Global View. PREREQUISITES FOR STOPPING AN INSTANCE You can stop an Amazon EBS-backed instance. Instances backed by an instance store volume do not support the Stop action. To better understand the differences between the two volume types, see Storage. To verify the root device type of an instance, you can use the Amazon EC2 console or the AWS CLI. Amazon EC2 console In the Amazon EC2 console, open the Instances pane and select an instance. The Root device type is listed on the Storage tab, under Root device details. AWS CLI You can verify the root device type of an instance by running the describe-instances AWS CLI command and checking the output for RootDeviceType: ebs or instance-store. For more information, see describe-instances in the AWS CLI Command Reference. anchoranchor * Amazon EC2 console * AWS CLI In the Amazon EC2 console, open the Instances pane and select an instance. The Root device type is listed on the Storage tab, under Root device details. MANUALLY STOP AND START AN INSTANCES You can stop and start your Amazon EBS-backed instance using the console or the command line. WARNING When you stop an instance, the data on any attached instance store volumes is erased. Before you stop an instance, verify that you've copied any data that you need from your instance store volumes to persistent storage, such as Amazon EBS or Amazon S3. Instances backed by an instance store volume do not support the Stop action. Console TO STOP AND START AN AMAZON EBS-BACKED INSTANCE 1. Sign in to the AWS Management Console and open the Amazon EC2 console at https://console.aws.amazon.com/ec2/. 2. In the left navigation pane, choose Instances and select the instance. 3. Choose Instance state, Stop instance. If this option is disabled, either the instance is already stopped or its root device is an instance store volume. 4. When prompted for confirmation, choose Stop. It can take a few minutes for the instance to stop. 5. (Optional) While your instance is stopped, you can modify certain instance attributes. For more information, see Modify a stopped instance. 6. To start a stopped instance, select the instance, and choose Instance state, Start instance. 7. It can take a few minutes for the instance to enter the running state. Command line TO STOP AND START AN AMAZON EBS-BACKED INSTANCE Run one of the following commands: * AWS CLI—stop-instances and start-instances. * AWS Tools for PowerShell—Stop-EC2Instance and Start-EC2Instance. * OS commands—You can initiate a shutdown using the shutdown or poweroff commands. When you use an OS command, the instance stops by default. You can change this behavior so that it terminates instead. For more information, see Change the instance initiated shutdown behavior. Using the OS halt command from an instance does not initiate a shutdown. If you use the halt command, the instance does not terminate; instead, it places the CPU into HLT, which suspends CPU operation. The instance remains running. anchoranchor * Console * Command line TO STOP AND START AN AMAZON EBS-BACKED INSTANCE 1. Sign in to the AWS Management Console and open the Amazon EC2 console at https://console.aws.amazon.com/ec2/. 2. In the left navigation pane, choose Instances and select the instance. 3. Choose Instance state, Stop instance. If this option is disabled, either the instance is already stopped or its root device is an instance store volume. 4. When prompted for confirmation, choose Stop. It can take a few minutes for the instance to stop. 5. (Optional) While your instance is stopped, you can modify certain instance attributes. For more information, see Modify a stopped instance. 6. To start a stopped instance, select the instance, and choose Instance state, Start instance. 7. It can take a few minutes for the instance to enter the running state. AUTOMATICALLY STOP AND START YOUR INSTANCES You can automate stopping and starting instances with the following services: Instance Scheduler on AWS You can use Instance Scheduler on AWS to automate the starting and stopping of EC2 instances. For more information, see How do I use Instance Scheduler with CloudFormation to schedule EC2 instances? Note that additional charges apply. AWS Lambda and an Amazon EventBridge rule You can use Lambda and an EventBridge rule to stop and start your instances on a schedule. For more information, see How do I stop and start Amazon EC2 instances at regular intervals using Lambda? Amazon EC2 Auto Scaling To ensure you have the correct number of Amazon EC2 instances available to handle the load for an application, create Auto Scaling groups. Amazon EC2 Auto Scaling ensures that your application always has the right capacity to handle the traffic demand, and saves costs by launching instances only when they are needed. Note that Amazon EC2 Auto Scaling terminates, rather than stops, unneeded instances. To set up Auto Scaling groups, see Get started with Amazon EC2 Auto Scaling. WHAT HAPPENS WHEN YOU STOP AN INSTANCE When you stop an instance, changes are registered at the OS level of the instance, some system resources are lost, and some persist. WHEN YOU STOP AN INSTANCE, THE FOLLOWING IS REGISTERED AT THE OS LEVEL: * The API request sends a button press event to the guest. * Various system services are stopped as a result of the button press event. Graceful shutdown is triggered by the ACPI shutdown button press event from the hypervisor. * ACPI shutdown is initiated. * The instance shuts down when the graceful shutdown process exits. There is no configurable OS shutdown time. * If the instance OS does not cleanly shut down within a few minutes, a hard shutdown is performed. * The instance stops running. * The instance status changes to stopping and then stopped. * [Auto Scaling] If your instance is in an Auto Scaling group, when the instance is in any Amazon EC2 state other than running, or if its status for the status checks becomes impaired, Amazon EC2 Auto Scaling considers the instance to be unhealthy and replaces it. For more information, see Health checks for Auto Scaling instances in the Amazon EC2 Auto Scaling User Guide. WHEN YOU STOP AN INSTANCE, THE FOLLOWING IS LOST: * Data stored on the RAM. * Data stored on the instance store volumes. * The public IPv4 address that Amazon EC2 automatically assigned to the instance upon launch or start. To retain a public IPv4 address that never changes, you can associate an Elastic IP address with your instance. WHEN YOU STOP AN INSTANCE, THE FOLLOWING PERSISTS: * Any attached Amazon EBS volumes. * Data stored on the attached Amazon EBS volumes. * Private IPv4 addresses. * IPv6 addresses. * Elastic IP addresses associated with the instance. Note that when the instance is stopped, you are charged for the associated Elastic IP addresses. For information about what happens when you stop a Mac instance, see Stop and terminate your Mac instance. WHAT HAPPENS WHEN YOU START AN INSTANCE When you start an instance, changes are registered at the instance level. WHEN YOU START AN EC2 INSTANCE, THE FOLLOWING OCCURS: * In most cases, the instance is migrated to a new underlying host computer (though in some cases, such as when an instance is allocated to a host in a Dedicated Host configuration, it remains on the current host). * Amazon EC2 assigns a new public IPv4 address to the instance if the instance is configured to receive a public IPv4 address. To retain a public IPv4 address that never changes, you can associate an Elastic IP address with your instance. MODIFY A STOPPED INSTANCE When an instance is stopped, you can treat its root volume like any other volume, and modify it (for example, repair file system problems or update software). YOU CAN MODIFY THE FOLLOWING ATTRIBUTES OF AN INSTANCE ONLY WHEN IT IS STOPPED: * Instance type * User data * Kernel * RAM disk If you try to modify these attributes while the instance is running, Amazon EC2 returns the IncorrectInstanceState error. YOU CAN CHANGE THE FOLLOWING ATTRIBUTES OF A STOPPED INSTANCE USING THE AMAZON EC2 CONSOLE OR THE AWS CLI: * Instance type * User data * EBS-optimization MODIFICATION OF THE FOLLOWING ATTRIBUTES USING THE AMAZON EC2 CONSOLE IS NOT SUPPORTED: * DeleteOnTermination * Kernel * RAM disk Modify an instance attribute You can modify an instance attribute using the Amazon EC2 console or the command line. Console To modify the following in the AWS Management Console See the following resource Instance type Change the instance type User data User data and the console EBS–optimization Modifying EBS–Optimization The DeleteOnTermination attribute of the root volume Update the block device mapping of a running instance. You are not required to stop the instance to change this attribute. Command line MODIFY AN INSTANCE ATTRIBUTE USING THE COMMAND LINE You can use the following commands to modify instance attributes. For more information about these command line interfaces see Access Amazon EC2. * modify-instance-attribute (AWS CLI) * Edit-EC2InstanceAttribute (AWS Tools for PowerShell) anchoranchor * Console * Command line To modify the following in the AWS Management Console See the following resource Instance type Change the instance type User data User data and the console EBS–optimization Modifying EBS–Optimization The DeleteOnTermination attribute of the root volume Update the block device mapping of a running instance. You are not required to stop the instance to change this attribute. MODIFY THE ROOT VOLUME OF AN INSTANCE You can modify the root volume of an instance by performing the following steps. 1. Detach the volume from the stopped instance. 2. Attach the volume to a running instance. 3. Modify the volume. 4. Detach the volume from the running instance. 5. Reattach the volume to the stopped instance. Make sure that you reattach the root volume using the storage device name specified as the root device in the block device mapping for the instance. For detailed steps on how to detach and attach a volume to an instance, see Detach an Amazon EBS volume from a Linux instance and Attach an Amazon EBS volume to an instance. For more help with specifying block device mappings, see Block device mappings. ENABLE STOP PROTECTION 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. This attribute can be set 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. IMPORTANT Setting the DisableApiStop attribute of the Amazon EC2 ModifyInstanceAttribute API action does not prevent you from accidentally stopping an instance when you initiate a shutdown from the instance using the OS shutdown or poweroff commands. STOP PROTECTION CONSIDERATIONS * Enabling stop protection does not prevent AWS from stopping the instance when the there are scheduled events 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 your instance. * You cannot enable stop protection for instance store-backed instances. * You cannot 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 API Reference. STOP PROTECTION ACTIONS * Enable stop protection for an instance at launch * Enable stop protection for a running or stopped instance * Disable stop protection for a running or stopped instance ENABLE STOP PROTECTION FOR AN INSTANCE AT LAUNCH You can enable stop protection for an instance when launching the instance using one of the following methods. 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 AWS CLI command to launch the instance, and specify the disable-api-stop parameter. aws ec2 run-instances \ --image-id ami-a1b2c3d4e5example \ --instance-type t3.micro \ --key-name MyKeyPair \ --disable-api-stop \ ... anchoranchor * Console * AWS CLI 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 using one of the following methods. Console TO ENABLE 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. Select the Enable check box, and then choose Save. AWS CLI TO ENABLE STOP PROTECTION FOR A RUNNING OR STOPPED INSTANCE Use the modify-instance-attribute AWS CLI command and specify the disable-api-stop parameter. aws ec2 modify-instance-attribute \ --instance-id i-1234567890abcdef0 \ --disable-api-stop anchoranchor * Console * AWS CLI TO ENABLE 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. Select the Enable check box, 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 check box, and then choose Save. AWS CLI TO DISABLE STOP PROTECTION FOR A RUNNING OR STOPPED INSTANCE Use the modify-instance-attribute AWS CLI command and specify the no-disable-api-stop parameter. aws ec2 modify-instance-attribute \ --instance-id i-1234567890abcdef0 \ --no-disable-api-stop anchoranchor * Console * AWS CLI 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 check box, and then choose Save. TEST APPLICATION RESPONSE TO STOP AND START You can use AWS Fault Injection Simulator to test how your application responds when your instance is stopped and started. For more information, see the AWS Fault Injection Simulator User Guide. TROUBLESHOOT STOPPING YOUR INSTANCE If you stopped an Amazon EBS-backed instance and it appears "stuck" in the stopping state, you can forcibly stop it. For more information, see Troubleshoot stopping your instance. Javascript is disabled or is unavailable in your browser. To use the Amazon Web Services Documentation, Javascript must be enabled. Please refer to your browser's Help pages for instructions. Document Conventions Use an AWS Marketplace instance Hibernate Did this page help you? - Yes Thanks for letting us know we're doing a good job! If you've got a moment, please tell us what we did right so we can do more of it. Did this page help you? - No Thanks for letting us know this page needs work. We're sorry we let you down. If you've got a moment, please tell us how we can make the documentation better. Did this page help you? Yes No Provide feedback Next topic:Hibernate Previous topic:Use an AWS Marketplace instance Need help? * Try AWS re:Post * Connect with an AWS IQ expert PrivacySite termsCookie preferences © 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. ON THIS PAGE * Related costs * Find running and stopped instances * Prerequisites * Manually stop and start * Automatically stop and start * What happens when you stop an instance * What happens when you start an instance * Modify a stopped instance * Enable stop protection * Test application response * Troubleshooting DID THIS PAGE HELP YOU? - NO Thanks for letting us know this page needs work. We're sorry we let you down. If you've got a moment, please tell us how we can make the documentation better. Feedback