28

I have a free micro instance launched in AWS EC2, I want to change the instance's OS to Cent OS. How would I be able to change the AMI <- (OS Image) of the instance?

Edit (Solved):

Terminated existing instance and launched a new one.

CoderUni
  • 5,474
  • 7
  • 26
  • 58
box
  • 289
  • 1
  • 3
  • 5
  • 1
    If you find an answer can be accepted, you should do as described here https://stackoverflow.com/help/accepted-answer instead of added strange words like "sloved". – harper May 15 '19 at 09:02
  • I would like to add that AWS Free Tier charges in hours so you don't have to worry when terminating and launching a new instance. You're still within the free tier as long as all of your free tier eligible t2 or t3.micro instance is running for less than 750 hours. – CoderUni Jan 22 '21 at 12:22
  • Please see this answer: https://stackoverflow.com/questions/52654676/is-it-possible-to-replace-the-ami-on-an-ec2-instance-with-a-different-ami – Junmin Hao Jul 12 '21 at 20:12

1 Answers1

27

You cannot update the AMI on an existing instance in AWS. The only way to do that is to terminate the current instance and relaunch the instances with the desired the AMI

Background

AMI is a special type of virtual appliance that is used to instantiate (create) a virtual machine within the Amazon Elastic Compute Cloud ("EC2") and I always refer to it as .iso image file.

Now I can use an .iso image file of a particular OS say Ubuntu to install it on a partition of my choice and if I want to change the OS on that partition then only way for me to do is by formatting that partition and installing a new OS from its .iso image file.

Rakesh Sankar
  • 9,337
  • 4
  • 41
  • 66
  • 2
    @nueverest there are ways to solve the problem, one quick way is to using user-data-scripts (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html) and get the latest code. – Rakesh Sankar Feb 18 '16 at 08:49
  • I was able to solve this by first finding the instance matching a particular "Name" Tag and then getting the server id of the instance matching that "Name". – nu everest Feb 18 '16 at 19:19