Do you want to create/customize an EC2 AMI?
Check out this tutorial by Rohan.
Briefly, steps are:
- Find a suitable base AMI. You can use EC2 Console to search
- Launch an instance from command-line using ami-id or EC2 Console
- Copy(scp) your private (ssh) key, ec2 key-pair and certificate from your machine to instance’s /mnt directory
- SSH to instance
- Install/customize tools and configuration
- Test if things work
- Install amazon-ami-tools
- Bundle image (from current running instance):
ec2-bundle-vol -d /mnt -k /mnt/pk-STRINGOFTHIRTYTWOLETTERSORDIGITS.pem -c /mnt/cert-STRINGOFTHIRTYTWOLETTERSORDIGITS.pem -u XXXXXXXXXXXX
XXXXXXXXXXXX is your Amazon account number without dashes.
- Deploy/copy AMI files to S3:
ec2-upload-bundle -b [your-s3-bucket] -m /mnt/image.manifest.xml -a [aws-access-key-id] -s [aws-secret-access-key]
Before bundling the image, do test customised settings and configuration; it’s pain to repeat above steps again, in order to change anything post-deployment.
Tip: Don’t shutdown/terminate the instance, you used to create AMI, until you have tested instances (based on new AMI). If anything goes wrong with new instances, you can come back to this instance (based on base-ami), change, bundle and redeploy.