The following instructions are for a Windows environment.
- Download a private key and an x.905 certificate from your control panel on Amazon website and place them into the same folder as the batch file and EC2 command line tools mentioned below.
- Configure your environment variables. I suggest either add the settings to your Windows installation options or use the following batch file:
@echo off set EC2_HOME=C:ec2 set PATH=%PATH%;%EC2_HOME%bin set EC2_PRIVATE_KEY=%EC2_HOME%privatekey.pem set EC2_CERT=%EC2_HOME%certificate.pem set JAVA_HOME=C:Program FilesJavajre1.6.0_xx "%JAVA_HOME%binjava" -version
privatekey.pem” and “
certificate.pem” are the files mentioned above.Be sure to have Java Runtime Environment 1.5+ installed. You will also need to download EC2 Command Line tools from Amazon AWS Resource Center page.
- Choose an Operating System image (AMI) that you will be using as a base for your server OS installation. For example, I am using an image of a base install of CentOS 5.0
- You can see a list of all available images using the following command “
ec2-describe-images -x all“. Here, “
-x all"means show all available images available. Each image has a unique number listed before the description. You will need this number to refer to the image.
ec2-add-keypair <private_key_file_name>– generate private/public key file to use with SSH client that you choose to use. Where
<name>is a name of a file of
ec2-run-instances ami-08f41161 -k <private_key_file_name>– run an instance of your AMI
ec2-terminate-instances <instance_number>– terminate a running instance
ec2-authorize default -p 22and
ec2-authorize default -p 80– open ports for HTTP and SSH2
ec2-describe-instances– display stats for your AMIs
ec2-upload-bundle --retry -b <your bundle name> -m /mnt/image.manifest.xml -a <your access key> -s <your secret access key>– copy bundled AMI to your S3 storage
ec2-bundle-vol -d /mnt -k /mnt/<private_key.pem> -c /mnt/<certificate.pem> -u <aws_user_number>
ec2-upload-bundle --retry -b <your-s3-bucket> -m /mnt/image.manifest.xml -a <aws-access-key-id> -s <aws-secret-access-key>