• No related posts.

      • No related posts.

        • No related posts.

          • No related posts.

              No related posts.

            Clone an EC2 instance

            These days Amazon sent me an email saying that the a instance that I’m using is on a server that is
            failing. To clone I had to:

            1. Install ec2-api-tools from http://s3.amazonaws.com/ec2-downloads/ec2-api-tools.zip on the failing instance
            2. Install Java from http://javadl.sun.com/webapps/download/AutoDL?BundleId=39484 (I’m using a small instance)
            3. Set .bashrc as follows:

            export EC2_HOME=~/ec2
            export PATH=$PATH:$EC2_HOME/bin
            export EC2_PRIVATE_KEY=$EC2_HOME/pk.pem
            export EC2_CERT=$EC2_HOME/cert.pem
            export JAVA_HOME=/usr

            Run :

            source /root/.bashrc

            4. Create a directory for the bundled files (/mnt/myimage in my case)
            5. Bundle the actual instance using:

            ec2-bundle-vol –cert ec2/cert.pem –privatekey ec2/pk.pem -s 2048 -u Your_AWS_Account_ID -d /mnt/myimage/

            -u : AWS Account ID is taken from AWS page Security Credentials, e.g: 1234-5678-9012-3456. Make sure to skip the “-” when using it.
            -s : size of the image
            -d : directory from step 4

            6. Upload the files to a S3 account using:

            ec2-upload-bundle -a access_key -s secret_key -b bucket_name –manifest /mnt/myimage/image.manifest.xml

            -a : access_key from Security Credentials page
            -s : secret_key from Security Credentials page
            -b : bucket name
            –manifest : name of the manifest file

            7. Register the AMI by going to your AWS EC2 console->AMI->Images->Register new AMI and enter:
            bucket_name/image.manifest.xml
            8. Create a new EC2 instance by using the newly registered AMI

            Note that you will need the [pk,cert].pem files too.

            Related posts:

            1. Amazon AWS and RightScale howto
            This entry was posted in Amazon, Cloud Computing and tagged , , , , .

            Leave a Reply