Download Amazon Elastic Compute Cloud User Guide for Linux

Transcript
Amazon Elastic Compute Cloud User Guide for Linux
Converting your Instance Store-Backed AMI to an
Amazon EBS-Backed AMI
[ec2-user ~]$ export AWS_ACCESS_KEY=your_access_key_id
[ec2-user ~]$ export AWS_SECRET_KEY=your_secret_access_key
4.
Prepare an Amazon EBS volume for your new AMI.
a.
Create an empty Amazon EBS volume in the same Availability Zone as your instance using the
ec2-create-volume command. Note the volume ID in the command output.
Important
This Amazon EBS volume must be the same size or larger than the original instance
store root volume.
[ec2-user ~]$ ec2-create-volume --size 10 --region us-west-2 --availab
ility-zone us-west-2b
VOLUME volume_id 10 us-west-2b creating 2014-01-24T23:11:45+0000
standard
b.
Attach the volume to your Amazon EBS-backed instance using the ec2-attach-volume command.
[ec2-user ~]$ ec2-attach-volume volume_id -i instance_id --device /dev/sdb
--region us-west-2
ATTACHMENT volume_id instance_id /dev/sdb attaching 2014-0124T23:15:34+0000
5.
Create a folder for your bundle.
[ec2-user ~]$ mkdir /tmp/bundle
6.
Download the bundle for your instance store-based AMI to /tmp/bundle using the
ec2-download-bundle command.
[ec2-user ~]$ ec2-download-bundle -b my-s3-bucket/bundle_folder/bundle_name
-m image.manifest.xml -a $AWS_ACCESS_KEY -s $AWS_SECRET_KEY --privatekey
/path/to/pk-HKZYKTAIG2ECMXYIBH3HXV4ZBEXAMPLE.pem -d /tmp/bundle
7.
Reconstitute the image file from the bundle using the ec2-unbundle command.
a.
Change directories to the bundle folder.
[ec2-user ~]$ cd /tmp/bundle/
b.
Run the ec2-unbundle command.
[ec2-user bundle]$ ec2-unbundle -m image.manifest.xml --privatekey
/path/to/pk-HKZYKTAIG2ECMXYIBH3HXV4ZBEXAMPLE.pem
8.
Copy the files from the unbundled image to the new Amazon EBS volume.
API Version 2015-04-15
86