A Simpler Way To Replace Instance Hardware on EC2


A while back I wrote an article describing a way to move the root EBS volume from one running instance to another. I pitched this as a way to replace the hardware for your instance in the event of failures.

Since then, I have come to the realization that there is a much simpler method to move your instance to new hardware, and I have been using this new method for months when I run into issues that I suspect might be attributed to underlying hardware issues.

This method is so simple, that I am almost embarrassed about having written the previous article, but I’ll point out below at least one benefit that still exists with the more complicated approach.

I now use this process as the second step—after a simple reboot—when I am experiencing odd problems like not being able to connect to a long running EC2 instance. (The zeroth step is to start running and setting up a replacement instance in the event that steps one and two do not produce the desired results.)

Here goes…


To move your EBS boot instance to new hardware on EC2:

  1. Stop the EC2 instance

    ec2-stop-instances $instanceid
  2. Start the EC2 instance

    ec2-start-instances $instanceid
  3. (optional) If you had an Elastic IP address associated with the instance, re-associate it:

    ec2-associate-address --instance $instanceid $ipaddress

It’s that simple. In my experience I almost always get new hardware for my instance by performing these steps. But…


Some things to consider when using this approach:

  1. Make sure you “stop” the instance and not “terminate” it. Terminating an instance generally loses all disk based information.

  2. This will only work with EBS boot instances. S3 based instances cannot be stopped.

  3. Stopping an EBS boot instance preserves files on attached EBS volumes, but all information on ephemeral instance-store disks will be lost (e.g., /mnt).

  4. There may be a small chance that you will get the exact same hardware after starting the instance again. If the internal IP address before and after are the same or if you continue observing what you sincerely believe is a host system issue, you may want to run the process again.

  5. There will be a short outage while your instance is stopped and started. In my experience this lasts roughly about the same time as it takes for a normal system to boot up.

  6. There is a risk that after stopping the instance, you will not be able to start it again because that availability zone no longer has open instances of that type.

I ran into this last issue recently when I stopped an m2.4xlarge instance in a us-east-1 availability zone. Upon attempting to start the instance, I received the error that instances of that type were not currently available in that zone. I ended up having to start a replacement instance from scratch in another us-east-1 availability zone which worked out fine, but I would have preferred to keep my instances closer to each other. Eventually instances freed up and I moved the server back to its home zone.

If I had used the more complicated approach to move the root EBS volume to a new instance I would have made sure that there was an instance of the right type available before stopping the original instance.


This method works well.

What would be even more useful is an easy way to move an instance to a new availabiity zone..

Any ideas?

skrewler: Sure: Create an EBS boot AMI from the old instance and start a new instance of that AMI in the new availability zone. It's basically two commands or API calls, plus copying your data volumes and associating Elastic IP addresses.

What I would be interested in - how exactly do you determine that there is a hardware issue?


Excellent question and the answer shows how cool EC2 is. When you suspect that there might be a problem with a standard "owned" server, you want to make sure before you purchase replacement parts or replacement systems that you're not wasting money and that the cause isn't really just a software issue.

With EC2 as this article demonstrates, you can easily switch hardware with no serious monetary investment, so it can be nearly a knee jerk reaction when you don't know what the problem is. If moving to new hardware doesn't fix the issue, then you can put in the harder investment of tracking down what might be causing the problem in the software or system configuration.

I generally switch to new hardware if a long running instance suddenly becomes unresponsive and a reboot does not fix it, or if it suddenly starts spewing out odd looking system errors in the syslog that seem to be related to something going wrong at a low level.

Great blog Eric!

As far as I see your old process does not really guarantee that you will find an instance in the requested availability zone. Since your last step (6) involves re-starting the new instance, even if there was one available in step 2 it may no longer be available.

To really guarantee a zone, you need to pay for a reserved instance.

Also your old method requires a run and a start, so you will be charged for 1 additional hour compared to the simpler method.


tom: Though the other article's method does not guarantee you will get a new instance, I suppose you could get the new instance before stopping the old one just in case the old one still has some life left in it. Perhaps I'm just grasping at straws for why it wasn't a complete waste of writing.

Eric loved the blog post, its really of great use.
The method also seems to be easier one. Just wondering will there any chances Accidental Termination of EC2 Instances from this??


stop/start should not terminate the instance. That said, you should always be prepared to recover from an accidental termination or instance.

There are rare times when I've stopped an instance and then not been able to start it for a bit because that instance type was not immediately available in the desired availability zone. I needed to run my instance as a different type for a while or to start a new instance in a different availability zone.

I have an Windows 2008 EBS instance, but need to change the security group to use VPC. Ordinarily, it is not possible to change the assigned security group. It has to be assigned when the instance is launched. Could I use your earlier instructions to create a new instance using my valuable ebd volume and assign a new security group?


I haven't run any Windows instances on EC2 so don't know how they differ. One thing you should be aware of is that you can change the rules of a security group that is already assigned to an instance even though you can't add new security groups.

Whats important here is that EBS Volumes are bound to hardware even if the instance is stopped.

If you have a degraded instance, make absolutely sure to also make snapshots of all attached EBS volumes and recreate them.

Else you could not only run into an unresponsive instance, but also permanently loose data, which even a snapshot can no longer help. (FS crash anyone ...)

We had the case that we had an instance failure and degraded hardware, started a new instance with the same volume and the new instance had errors and starting / stopping seemed not to help. Then it worked finally and then the Filesystem crashed permanently with memory errors.

From this I presume that an instance is still run "near" its Volume, which might be a degraded region within an availability zone.

Because we just got a stable working instance again when we used a new volume created from a snapshot.

Hope that helps.

Best Regards,



I have fixed many problems by simply stopping and starting an instance without replacing EBS volumes. In my experience EBS volumes almost never have issues. However, it is good to point out that there are other things to try like replacing EBS volumes if you continue to have issues.

Taking snapshots of your EBS volumes is recommended both on a regular basis and before attempting to do anything unusual with the instance (like stop/start).

Leave a comment

Ubuntu AMIs

Ubuntu AMIs for EC2:

AWS Jobs

AWS Jobs

More Entries

Throw Away The Password To Your AWS Account
reduce the risk of losing control of your AWS account by not knowing the root account password As Amazon states, one of the best practices for using AWS is Don’t…
AWS Community Heroes Program
Amazon Web Services recently announced an AWS Community Heroes Program where they are starting to recognize publicly some of the many individuals around the world who contribute in so many…
EBS-SSD Boot AMIs For Ubuntu On Amazon EC2
With Amazon’s announcement that SSD is now available for EBS volumes, they have also declared this the recommended EBS volume type. The good folks at Canonical are now building Ubuntu…
EC2 create-image Does Not Fully "Stop" The Instance
The EC2 create-image API/command/console action is a convenient trigger to create an AMI from a running (or stopped) EBS boot instance. It takes a snapshot of the instance’s EBS volume(s)…
Finding the Region for an AWS Resource ID
use concurrent AWS command line requests to search the world for your instance, image, volume, snapshot, … Background Amazon EC2 and many other AWS services are divided up into various…
Changing The Default "ubuntu" Username On New EC2 Instances
configure your own ssh username in user-data The official Ubuntu AMIs create a default user with the username ubuntu which is used for the initial ssh access, i.e.: ssh ubuntu@<HOST>…
Default ssh Usernames For Connecting To EC2 Instances
Each AMI publisher on EC2 decides what user (or users) should have ssh access enabled by default and what ssh credentials should allow you to gain access as that user.…
New c3.* Instance Types on Amazon EC2 - Nice!
Worth switching. Amazon shared that the new c3.* instance types have been in high demand on EC2 since they were released. I finally had a minute to take a look…
Query EC2 Account Limits with AWS API
Here’s a useful tip mentioned in one of the sessions at AWS re:Invent this year. There is a little known API call that lets you query some of the EC2…
Using aws-cli --query Option To Simplify Output
My favorite session at AWS re:Invent was James Saryerwinnie’s clear, concise, and informative tour of the aws-cli (command line interface), which according to GitHub logs he is enhancing like crazy.…
Reset S3 Object Timestamp for Bucket Lifecycle Expiration
use aws-cli to extend expiration and restart the delete or archive countdown on objects in an S3 bucket Background S3 buckets allow you to specify lifecycle rules that tell AWS…
Installing aws-cli, the New AWS Command Line Tool
consistent control over more AWS services with aws-cli, a single, powerful command line tool from Amazon Readers of this tech blog know that I am a fan of the power…
Using An AWS CloudFormation Stack To Allow "-" Instead Of "+" In Gmail Email Addresses
Launch a CloudFormation template to set up a stack of AWS resources to fill a simple need: Supporting Gmail addresses with “-” instead of “+” separating the user name from…
New Options In ec2-expire-snapshots v0.11
The ec2-expire-snapshots program can be used to expire EBS snapshots in Amazon EC2 on a regular schedule that you define. It can be used as a companion to ec2-consistent-snapshot or…
Replacing a CloudFront Distribution to "Invalidate" All Objects
I was chatting with Kevin Boyd (aka Beryllium) on the ##aws Freenode IRC channel about the challenge of invalidating a large number of CloudFront objects (35,000) due to a problem…
Email Alerts for AWS Billing Alarms
using CloudWatch and SNS to send yourself email messages when AWS costs accrue past limits you define The Amazon documentation describes how to use the AWS console to monitor your…
Cost of Transitioning S3 Objects to Glacier
how I was surprised by a large AWS charge and how to calculate the break-even point Glacier Archival of S3 Objects Amazon recently introduced a fantastic new feature where S3…
Running Ubuntu on Amazon EC2 in Sydney, Australia
Amazon has announced a new AWS region in Sydney, Australia with the name ap-southeast-2. The official Ubuntu AMI lookup pages (1, 2) don’t seem to be showing the new location…
Save Money by Giving Away Unused Heavy Utilization Reserved Instances
You may be able to save on future EC2 expenses by selling an unused Reserved Instance for less than its true value or even $0.01, provided it is in the…
Installing AWS Command Line Tools from Amazon Downloads
This article describes how to install the old generation of AWS command line tools. For the most part, these have been replaced with the new AWS cli that is…
Convert Running EC2 Instance to EBS-Optimized Instance with Provisioned IOPS EBS Volumes
Amazon just announced two related features for getting super-fast, consistent performance with EBS volumes: (1) Provisioned IOPS EBS volumes, and (2) EBS-Optimized Instances. Starting new instances and EBS volumes with…
Which EC2 Availability Zone is Affected by an Outage?
Did you know that Amazon includes status messages about the health of availability zones in the output of the ec2-describe-availability-zones command, the associated API call, and the AWS console? Right…
Installing AWS Command Line Tools Using Ubuntu Packages
See also: Installing AWS Command Line Tools from Amazon Downloads Here are the steps for installing the AWS command line tools that are currently available as Ubuntu packages. These include:…
Ubuntu Developer Summit, May 2012 (Oakland)
I will be attending the Ubuntu Developer Summit (UDS) next week in Oakland, CA. ┬áThis event brings people from around the world together in one place every six months to…
Uploading Known ssh Host Key in EC2 user-data Script
The ssh protocol uses two different keys to keep you secure: The user ssh key is the one we normally think of. This authenticates us to the remote host, proving…
Seeding Torrents with Amazon S3 and s3cmd on Ubuntu
Amazon Web Services is such a huge, complex service with so many products and features that sometimes very simple but powerful features fall through the cracks when you’re reading the…
There are a number of CloudCamp events coming up in cities around the world. These are free events, organized around the various concepts, technologies, and services that fall under the…
Use the Same Architecture (64-bit) on All EC2 Instance Types
A few hours ago, Amazon AWS announced that all EC2 instance types can now run 64-bit AMIs. Though t1.micro, m1.small, and c1.medium will continue to also support 32-bit AMIs, it…
ec2-consistent-snapshot on GitHub and v0.43 Released
The source for ec2-conssitent-snapshot has historically been available here: ec2-consistent-snapshot on Launchpad.net using Bazaar For your convenience, it is now also available here: ec2-consistent-snapshot on GitHub using Git You are…
You Should Use EBS Boot Instances on Amazon EC2
EBS boot vs. instance-store If you are just getting started with Amazon EC2, then use EBS boot instances and stop reading this article. Forget that you ever heard about instance-store…