domingo, 27 de julio de 2014

AWS: Convert T1 instances to T2

AWS released new T2 instance type recently. New instance type only support HVM virtualization. What happen if you have a T1 PVM instance and want to move to T2? Because  PVM virtualization is not supported in T2, you can't directly change instance type using AWS EC2 web console. But you can convert it! To do it, I suggest you to follow next guide.

NOTE: If you are going to use this guide with production instances is highly recommended to create an image before proceed.

The procedure has been tested using Amazon Linux instances, but should work with any other Linux flavors: Ubuntu, SUSE, Redhat, etc.

Imagine you have one T1 micro PVM instance with next characteristics:




First, login to the instance and ensure is updated. If not, I recommend you to update the instance to the latest stable version using apt-get/yum commands:




Wait until instance is updated and reboot, if needed. Verify everything is correct. I´m also going to create a file named info.txt just to know this is the root volume associated to my T1 PVM instance:




Now, launch a new T2 instance. Don't forget to:
  • Select a compatible T2 AMI closer to your current T1 AMI with same architecture (32 or 64bits)
  • Select same size for root volume
  • Select same instance type (if original T1 instance is t1.micro, select t2.micro)
  • Launch T2 instance in the same availability zone (AZ) of your current T1 instance
Example:




Stop both instances. Now, go to AWS EC2 web console, Volumes section and:
  • Set an easy-to-remember name for each volume
  • Review attachment information of T2 HVM root volume (at least) and take note of device name. In my example: /dev/xvda. We'll need this information later.
  • Detach both root volumes
After these steps, both volumes should be available in AWS console:





Now, we need to launch a new instance. We'll use this instance to perform required changes, so work instance seems a good name. Don't forget to launch this new instance in the same availability zone of T1 and T2 instances:




Attach T1 PVM and T2 HVM volumes as secondary volumes in work instance:




As you can see, T1 PVM volumes has been attached in /dev/sdf device and T2 HVM volume in /dev/sdg device. This information is important because will help us to identify volumes inside work instance.

Now, login to the work instance and run dmesg command to know how volumes are identified by the kernel:




According to dmesg information, /dev/sdf (PVM volume) is associated to /dev/xvdf and /dev/sdg (HVM volume) to /dev/xvdg1. Create two mountpoint directories, one for each device, and mount them. Required commands:
  • sudo mkdir /pvm
  • sudo mkdir /hvm
  • sudo mount /dev/xvdf /pvm
  • sudo mount /dev/xvdg1 /hvm

In the next step we're going to backup current HVM kernel. To ensure maximum compatibility, preserve current HVM kernel is recommended. You can skip this step if you're 100% sure PVM kernel will work with the new T2 HVM instance. You will need to backup /boot directory inside /hvm and modules associated to the running kernel. To know what is the active kernel, review /hvm/boot/grub/menu.lst file. Will give you the information to know what modules are required to backup:




For our example, next commands will be required:
  • sudo cp -prf /hvm/boot /tmp/
  • cat /hvm/boot/grub/menu.lst . Active kernel is tagged 3.10.42-52.145.amzn1.x86_64. So, command to backup modules will be:
  • sudo cp -prf /hvm/lib/modules/3.10.42-52.145.amzn1.x86_64 /tmp/

Next steps will be: remove all files from HVM volume, copy files from PVM volume to HVM and restore HVM kernel. The commands:
  • sudo rm -rf /hvm/*
  • sudo cp -prf /pvm/* /hvm/
  • sudo rm -rf /hvm/boot
  • sudo cp -prf /tmp/boot /hvm/
  • sudo cp -prf /tmp/3.10.42-52.145.amzn1.x86_64/ /hvm/lib/modules/




Important: review root label in kernel configuration, fstab file and root filesystem. In order to work, they need to be the same. In previous screenshot, volume labeled as / will be use as root device by kernel configuration and fstab file. Requesting information about HVM volume label, I get the same value. Finally, HVM volume filesystem is ext4. So, nothing additional is required in my example. If you find differences in your environment, you'll need to modify /hvm/boot/grub/menu.lst, /hvm/etc/fstab and/or HVM volume label to solve it. Otherwise, instance start-up will fail.

If all is correct, umount both volumes:
  • sudo umount /pvm
  • sudo umount /hvm
Go to AWS EC2 web console, Volumes section, and detach both secondary volumes (T1 PVM and T2 HVM volumes) from work instance.

Now, attach HVM volume as T2 instance root volume. In AWS EC2 web console, Volumes section (Important: don't forget to put as device name the value you copied previously. In my example: /dev/xvda):




Optional: If T1 instance has an Elastic IP assigned, I suggest you to associate this IP to the new T2 instance. To do it, just disassociate Elastic IP from T1 instance and associate to the new T2 instance in Elastic IPs section. Example:






All done. Now you can start and login to the new T2 instance using the old Elastic IP. As you can see in the next screenshot, files contained are the same T1 PVM root volume, but using the new T2 instance type:





If after procedure you experience issues during T2 instance start-up, in AWS EC2 web console select the instance, right click and select Get System Log. If there is any issue associated to the kernel, filesystem or volume label; useful information for troubleshooting will be displayed here.

When all work as expected, you can remove old T1 and work instance. Be sure you won't need them before remove because as soon as you delete them won't be able to access again.

57 comentarios:

Anónimo dijo...

Thanks a lot! I was be able to accomplish the migration from t1.micro (PV) to t2.micro (HVM) following this post... great job

Francisco dijo...

Very nice post, I was also able to accomplish the task. Thanks!

JShort dijo...

Shouldn't this be:

sudo cp -prf /tmp/3.10.42-52.145.amzn1.x86_64 /hvm/lib/modules/

Note the lack of trailing slash on the 1st positional argument.

Unknown dijo...

Thanks! The clearest tutorial I have read. It helps me a lot when i upgrade my ubuntu-t1.micro instance to t2.micro.

Unknown dijo...

Thank you Javier! Very clear instructions for migrating from t1, to t2 EC2 micro instances.

K. Allen Gillette dijo...

Thanks for the clear, step-by-step instructions! I was successful in migrating from a t1.micro instance to a t2.micro. Unfortunately, I can't seem to reassign the Elastic IP (and DNS record) from the t1.micro instance, which appears to be in EC2-Classic, while the t2.micro is in EC2-VPC. Equally clever recommendations for work-arounds appreciated!

Manu dijo...

Funciona genial!!

Unknown dijo...

Even with google translate! saved me hours. thank you

Unknown dijo...

Is it suitable even to migrate a m1.small PV to t2.medium HVM? Thanks

Javier Sianes dijo...

Stefano: yes, it is.

Unknown dijo...

Thx man, worked like a charm! What a timesaver, really appreciate it!

吾人‧祖絲 dijo...
Este comentario ha sido eliminado por el autor.
Ember dijo...

Thank you for the article. :) One extra thing I had to do was setup the aws cli and migrate my Elastic IP to be on the VPC network. http://docs.aws.amazon.com/cli/latest/reference/ec2/move-address-to-vpc.html

Mike dijo...

Very useful. Despite my own stupidity I did an ubuntu migration very smoothly.
Thanks.

JB dijo...

Thanks so much for this! I'd been lazy on porting my servers, primarily because I had no Idea how to do it. Very well done!

Unknown dijo...

I agree with your points but i can't understand what's logic behind by including with the number? Why most of the marketers will suggest that one? Is there any important factor within that please convey me.....

Digital Marketing Training in Chennai

Hadoop Training in Chennai

Unknown dijo...

I migrated my Ubuntu 14.04 from t1 to t2 using your guide. Gracias!

Unknown dijo...

Thanks for updating your information for more updates AWS Online Training

siva dijo...

This blog is the general information for the feature. You got a good work for these blog.We have a developing our creative content of this mind.
Thank you for this blog. This for very interesting and useful.
Java training in Chennai
Java training in Bangalore
Java online training
Java training in Pune
Java training in Bangalore|best Java training in Bangalore

service care dijo...

Inspiring writings and I greatly admired what you have to say , I hope you continue to provide new ideas for us all and greetings success always for you.
Keep update more information..
xiaomi service centre chennai
redmi service center
mi service center
redmi service center near me
redmi mobile service centre in chennai
redmi note service center in chennai

Suresh dijo...
Este comentario ha sido eliminado por el autor.
service care dijo...

I think this is the best article today about the future technology. Thanks for taking your own time to discuss this topic, I feel happy about that curiosity has increased to learn more about this topic. Keep sharing your information regularly for my future lenovo service center in velachery
lenovo service center in porur
lenovo service center in vadapalani

service care dijo...

Your blog’s post is just completely quality and informative. Many new facts and information which I have not heard about before. Keep sharing more blog posts.
redmi service center
mi service center
redmi service center near me
redmi mobile service centre in chennai

service care dijo...
Este comentario ha sido eliminado por el autor.
service care dijo...

This information is impressive; I am inspired with your post writing style & how continuously you describe this topic. After reading your post, thanks for taking the time to discuss this, I feel happy about it and I love learning more about this topic.
lg mobile service center in porur
lg mobile service center in vadapalani

service care dijo...

This is the exact information I am been searching for, Thanks for sharing the required infos with the clear update and required points.
oppo service center chennai

service care dijo...

Hi! Thank you for the share this information. This is very useful information for online blog review readers. Keep it up such a nice posting like this.
best mobile service center in chennai
mobile service center in velacherry

service care dijo...

Alot of blogs I see these days don't really provide anything that I'm interested in, but I'm most definitely interested in this one. Just thought that I would post and let you know. Nice! thank you so much! Thank you for sharing.
lg mobile service center near me
lg mobile service center in velachery

digitalsourabh dijo...

PHP Training in Bhopal
Graphic designing training in bhopal
Python Training in Bhopal
Android Training in Bhopal
Machine Learning Training in Bhopal
Digital Marketing Training in Bhopal
https://99designs.com/blog/trends/top-10-web-design-trends-for-2014/

shivani dijo...

An astounding web diary I visit this blog, it's inconceivably magnificent. Strangely, in this current blog's substance made point of fact and sensible. The substance of information is instructive.
Oracle Fusion Financials Online Training
Oracle Fusion HCM Online Training
Oracle Fusion SCM Online Training

spot dijo...

Excellant your post and blog.
It’s amazing in support of me totruly have a blog site, which will be valuable meant for my knowledge. Thanks admin
Transcription in USA
Transcription in USA
Transcriptions in US
Medical Transcription in USA
Medical Transcription Companies in USA
best Medical Transcription Companies in USA
Medical Transcription Services USA
Transcription companies in USA
Transcription services in USA
transcription companies in us
Transcription USA
General Transcription companies in US
Medical Transcriptionist in us
Almighty

shivani dijo...

A bewildering web journal I visit this blog, it's unfathomably heavenly. Oddly, in this present blog's substance made purpose of actuality and reasonable. The substance of data is informative
Oracle Fusion Financials Online Training
Oracle Fusion HCM Online Training
Oracle Fusion SCM Online Training

shivani dijo...

A befuddling web diary I visit this blog, it's incredibly grand. Strangely, in this present blog's substance made motivation behind fact and sensible. The substance of information is instructive
Oracle Fusion Financials Online Training
Oracle Fusion HCM Online Training
Oracle Fusion SCM Online Training

Techxinx dijo...

Thanks for sharing excellent information.If you Are looking Best smart autocad classes in india,
provide best service for us.
autocad in bhopal
3ds max classes in bhopal
CPCT Coaching in Bhopal
java coaching in bhopal
Autocad classes in bhopal
Catia coaching in bhopal

shivani dijo...

An overwhelming web journal I visit this blog, it's unfathomably amazing. Unusually, in this present blog's substance made inspiration driving truth and reasonable. The substance of data is enlightening
Oracle Fusion Financials Online Training
Oracle Fusion HCM Online Training
Oracle Fusion SCM Online Training

Benish dijo...

Nice post...Thanks for sharing useful information...
Python training in Chennai
Python training in OMR
Python training in Velachery
Python certification training in Chennai
Python training fees in Chennai
Python training with placement in Chennai
Python training in Chennai with Placement
Python course in Chennai
Python Certification course in Chennai
Python online training in Chennai
Python training in Chennai Quora
Best Python Training in Chennai
Best Python training in OMR
Best Python training in Velachery
Best Python course in Chennai

shivani dijo...

Thanks for sharing useful information.. we have learned so much information from your blog..... keep sharing
Oracle Fusion HCM Online Training

verdure skills india pvt ltd dijo...

nice blog
get best placement at VSIPL

digital marketing services
Web development Services
seo network point

Jack sparrow dijo...

This post is really nice and informative. The explanation given is really comprehensive and informative . Thanks for sharing such a great information..Its really nice and informative . Hope more artcles from you. I want to share about the best learn java with free bundle videos provided and java training .

Training Institute dijo...

We believe in practice what you preach and thus the Amazon Web Services Training at APTRON Gurgaon involves "Hands-on-experience" therefore each person is motivated to practically conduct each topic which is discussed in the sessions provided at APTRON Gurgaon.
For More Info: AWS Course in Gurgaon

Unknown dijo...


This is most informative and also this post most user friendly and super navigation to all posts. Thank you so much for giving this information to me.AWS training in Chennai.
Java training in chennai | Java training in annanagar | Java training in omr | Java training in porur | Java training in tambaram | Java training in velachery

Ranvijay Singh dijo...

SEO Training in Bhopal
Digital Marketing Training in Bhopal
SEO Company in Bhopal
Digital Marketing Company in Bhopal
High PR Profile Creation Sites
Web 2.0 Sites list
Directory Submission Sites list
Article Submission Sites list
Social Bookmarking Sites list
Digital Marketing Course in Bhopal

Salman dijo...

Effective blog with a lot of information. I just Shared you the link below for Courses .They really provide good level of training and Placement,I just Had Amazon Web Services Classes in this institute,Just Check This Link You can get it more information about the Amazon Web Services course.


Java training in chennai | Java training in annanagar | Java training in omr | Java training in porur | Java training in tambaram | Java training in velachery

nizam dijo...

This is an awesome post.Really very informative and creative contents about Java. These concept is a good way to enhance the knowledge.I like it and help me to development very well.Thank you for this brief explanation and very nice information.Well, got a good knowledge.
Java training in chennai | Java training in annanagar | Java training in omr | Java training in porur | Java training in tambaram | Java training in velachery

radhika dijo...

Thanks for sharing useful information.. we have learned so much information from your blog..... keep sharing
AWS training in Chennai

AWS Online Training in Chennai

AWS training in Bangalore

AWS training in Hyderabad

AWS training in Coimbatore

AWS training


Sarthak Yadav dijo...

Good Post! , it was so good to read and useful to improve my knowledge as an updated one, keep blogging.After seeing your article I want to say that also a well-written article with some very good information which is very useful for the readers....thanks for sharing it and do share more posts likethis. https://www.3ritechnologies.com/course/online-python-certification-course/

saketh321 dijo...

Your work is very good and I appreciate you and hopping for some more informative posts. ExcelR Data Science Course In Pune

Deekshitha dijo...

Informative blog
Data Science Course in Pune

shivam dijo...

Digibrom is the Best Digital Marketing
Training & Services In Bhopal
Digibrom is the Best Digital Marketing Training & Services in Bhopal, providing complete digital growth for your business. We are one of the leading Digital Marketing company in Bhopal, and we are experts in digital marketing & web design. The market penetration along with the use of digital technology is our power. We serve businesses according to the need and requirements of the customers and deliver quality work in time because Digibrom is the best digital marketing training institute in Bhopal and service provider. We create likable content that increases the time spent by the customer on the internet.Digital Marketing is one of the greatest opportunities for a great career. Including lots of opportunities within the field and attractive salaries, it’s the best time to connect a digital marketing Training. These days Digibrom is the Best Digital Marketing Training In Bhopal. it has become a demand for professions to have a solid online presence and for that, people need to get help from digital marketing companies to improve their online appearance. Digibrom is the best digital marketing Training & Services company in Bhopal.
Digital marketing Training in bhopal

Digital marketing course bhopal

digitalrishu dijo...

Digibrom is the Best Digital Marketing
Training & Services In Bhopal
Digibrom is the Best Digital Marketing Training & Services in Bhopal, providing complete digital growth for your business. We are one of the leading Digital Marketing company in Bhopal, and we are experts in digital marketing & web design. The market penetration along with the use of digital technology is our power. We serve businesses according to the need and requirements of the customers and deliver quality work in time because Digibrom is the best digital marketing training institute and service provider. We create likable content that increases the time spent by the customer on the internet.
Digital marketing Training in bhopal
Digital marketing company in bhopal

Datascience Books dijo...

Excellent Blog! I would like to thank for the efforts you have made in writing this post. I am hoping the same best work from you in the future as well. I wanted to thank you for this websites! Thanks for sharing. Great websites!
Data Science Training in Bangalore

InstituteBlr dijo...

I just got to this amazing site not long ago. I was actually captured with the piece of resources you have got here. Big thumbs up for making such wonderful blog page!
data analytics course in bangalore

data analytics books dijo...

I am a new user of this site, so here I saw several articles and posts published on this site, I am more interested in some of them, hope you will provide more information on these topics in your next articles.
data analytics training in bangalore

Datascience Course Analyst dijo...

Great post i must say and thanks for the information. Education is definitely a sticky subject. However, is still among the leading topics of our time. I appreciate your post and look forward to more.
Data Science Course in Bangalore

Venkygaming dijo...

Hi this is venky here to tell about that blog is usefull and topic featured in content is necessary.

1000 Social BookMarking Sites List
free social bookmarking sites list
new updated social bookmarking sites list

Unknown dijo...

"Wonderful contribution!" I'm blown away by the information you've shared. Thank you so much for everything. Continue to write your blog.
Best Interior Designers

Educational Services dijo...

Thanks For Sharing such a wonderful article the way you presented is really amazing It was extraordinarily simple to discover my way around and amazingly clear, this is staggering!!!
Best Software Training Institutes