Saving a Customised Linux Amazon Instance
Posted By : Arvind Das | 19-Jun-2012
Amazon S3 is storage for the Internet. It is designed to make web-scale computing easier for developers.
Amazon S3 provides a simple web services interface that can be used to store and retrieve any amount of data, at any time, from anywhere on the web. It gives any developer access to the same highly scalable, reliable, secure, fast, inexpensive infrastructure that Amazon uses to run its own global network of web sites. The service aims to maximize benefits of scale and to pass those benefits on to developers.
Amazon Elastic Compute Cloud (Amazon EC2) is a web service that provides resizable compute capacity in the cloud. It is designed to make web-scale computing easier for developers.
- You should have an EC2 and S3 account already.If not Create
- Create your Private key , Certificate key. To create these you must have an aws account. After successful creating your new account go to My Account>security credentials and download your keys.
- You will also need your aws-access key and aws-security key. Download them.
- Now go to your AWS account and select EC2. Launch one instance from here. Be sure to create a keypair and a server name.Then follow instructions to launch an instance. You can choose default settings for firewall or may configure it.
- After you have launched your machine. Select checkbox of your instance in EC2. From the tab above it select connect and it will show an option like
- Copy and paste below given command into your terminal and press enter. Now , you will be running your selected OS from root.
ssh -i your_key.pem [email protected]
#wget http://s3.amazonaws.com/ec2-downloads/ec2-ami-tools.zip #unzip ec2-ami-tools
#wget http://s3.amazonaws.com/ec2-downloads/ec2-api-tools.zip #unzip ec2-api-tools.zip
mv /root/ec2-api-tools-your-version-num /root/.ec2 mv /root/ec2-ami-tools-your-version-num /root/.ec2 cd /root
vi .bashrc
export EC2_HOME=~/.ec2/ec2-api-tools-your-version export PATH=EC2_HOME/bin:$PATH export EC2_AMITOOL_HOME=~/.ec2/ec2-ami-tools-your_version export PATH=EC2_AMITOOL_HOME/bin:$PATH export EC2_PRIVATE_KEY=~/.ec2/your-private-key.pem export EC2_CERT=~/.ec2/your-certificate-key.pem export JAVA_HOME=/usr/java/default/
#source ~/.bashrc
# ec2-bundle-vol –help
# ec2-bundle-vol -d /mnt -k ~/.ec2/your_private_key.pem -c ~/.ec2/your_certficate_key.pem -u XXXXXXXXXXXX
# ec2-upload-bundle -b [your-s3-bucket] -m /mnt/image.manifest.xml -a [aws-access-key-id] -s [aws-secret-access-key]
It’s better to create a bucket before you issue this command. Go to your S3 account and select an option to create a bucket. Register the AMI . You’ve now created an AMI and stored it on S3, but you still have to tell EC2 where the AMI is located so you can create an instance of it.
Go back to your terminal, and issue the command:
$ ec2-register [your_bucket]/image.manifest.xml
The command should respond with an AMI ID like ami-xxxxxxx. Use this key to start up an instance of your AMI.
When you run “ec2-bundle-vol” command to make backup of your instance second time , it shows and error.
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Arvind Das
Technical Product Manager experienced in developing Real Time Planning Solutions, Video CMS with experience in Product Management and technical expertise in Reactive applications , Micro-services . Spending most of his time in planning , new solutions.