ssh -i ~/.ec2/my.pem [email protected] "cat /var/log/secure | grep 'refused connect'"
When using SSH to run commands across multiple machines without exchanging your public key, you need to type in your password for each machine. A quick and simple way of setting this up is to create a public key:
ssh-keygen -t rsa
-
Download the developer tools from http://aws.amazon.com/developertools
-
Add path to /etc/paths.d/Amazon
/path/to/.ec2/ec2-api-tools-/bin /path/to/.ec2/ElasticLoadBalancing-/bin /path/to/.ec2/AutoScaling-/bin
-
Export vars
export EC2_HOME=/path/to/.ec2/ec2-api-tools- export EC2_PRIVATE_KEY=${HOME}/.ec2/pk.pem export EC2_CERT=${HOME}/.ec2/cert.pem export EC2_KEYPAIR=${HOME}/.ec2/my.pem export EC2_ACCOUNT=<account_number> export EC2_ACCESS_KEY_ID=<access_key_id> export EC2_SECRET_ACCESS_KEY=<access_key> export EC2_TARGETHOST=ec2.compute-1.amazonaws.com export EC2_BUCKET=my-ami-bucket export EC2_IMGNAME=my-ami-img export EC2_PLAT=i386 export AWS_ELB_HOME=${HOME}/.ec2/ElasticLoadBalancing- export AWS_CREDENTIAL_FILE=${HOME}/.ec2/credential-file-path.template export AWS_AUTO_SCALING_HOME=${HOME}/.ec2/AutoScaling-
-
Create AMI
This command creates the bundle:
cd /mnt
ec2-bundle-vol -d /mnt -k ${HOME}/.ec2/pk-*.pem -c ${HOME}/.ec2/cert-*.pem \
-u $EC2_ACCOUNT \
-r $EC2_PLAT -p $EC2_IMGNAME
This command uploads the bundle to S3:
ec2-upload-bundle -b $EC2_BUCKET \
-m /mnt/${EC2_IMGNAME}.manifest.xml \
-a $EC2_ACCESS_KEY_ID \
-s $EC2_SECRET_ACCESS_KEY
- Register image for AMI consumption
This command can be executed on your local machine with the prior environment variables set:
ec2-register -K ${EC2_PRIVATE_KEY} -C ${EC2_CERT} ${EC2_BUCKET}/${EC2_IMGNAME}.manifest.xml
To unregister an AMI:
ec2dereg ${EC2_IMGNAME}