Stop and start Amazon EC2 instances
You can stop and start your instance if it has an Amazon EBS volume as its root device. When you stop an instance, it shuts down. When you start an instance, it 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 Amazon EC2 instances. If you want to hibernate an instance to save the contents from the instance memory (RAM), see Hibernate your Amazon EC2 instance. For distinctions between instance lifecycle actions, see Differences between instance states.
Contents
Manually stop and start your instances
You can stop and start your Amazon EBS-backed instances (instances with EBS root devices). You can't stop and start instances with instance store root device.
Warning
When you stop an instance, the data on any instance store volumes is erased. Before you stop an instance, verify that you've copied any data that you need from the instance store volumes to persistent storage, such as Amazon EBS or Amazon S3.
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 use Lambda to stop and start Amazon EC2 instances at regular intervals?
- 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.
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
Find the initial and most recent launch times
When you describe an instance, the launch time for the instance is its most recent launch time. After you stop and start an instance, the launch time reflects the new instance start time. To find the initial launch time for an instance, even after stopping and starting it, view the time at which the primary network interface was attached to the instance.
To find the most recent launch time using the console, select the instance and look under Instance details on the Details tab. To find the attachment time for the primary network interface, look under Network interfaces on the Networking tab.
Using the AWS CLI, run the following describe-instances command to display both the initial launch time and the most recent launch time for the specified instance.
aws ec2 describe-instances --instance-id
i-09453945dcf1529e9
--query 'Reservations[*].Instances[*].{InstanceID:InstanceId,InitialLaunch:NetworkInterfaces[0].Attachment.AttachTime,LastLaunch:LaunchTime}'
The following is example output.
{
"InstanceID": "i-09453945dcf1529e9",
"InitialLaunch": "2024-03-31T00:47:08+00:00",
"LastLaunch": "2024-06-30T00:24:06+00:00"
}