Creating new EC2 images
Until this point in the chapter, I’ve explained your options for managing images that already exist. But what about creating your own images? Though it’s certainly possible to use images that have been created by Amazon or other third parties, you may at some point want to create your own images, for two reasons:
✓ You have used an Amazon image, or another third-party image, and you have extended it by installing your own software components, and now you want to use the extended image as your base line image going forward rather than endure the launch image/install software cycle for every instance you launch.
✓ You want to use your own system as the basis for the images you use because of a general preference or a concern about the security of the image.
Creating EBS-backed images
The image creation process varies based on whether you’re creating an EBS or an S3-backed image, and whether you’re creating a Linux- or Windows based image. The EBS-backed image creation process is significantly simpler, though it’s accompanied by limitations. Typically, you start with an already existing EBS-backed instance that you have modified. However, it’s possible to create an EBS-backed image from an S3-backed instance — though it’s possible only if the instance is Linux-based.
Creating an EBS-backed Windows image from an S3-backed Windows instance isn’t possible. You can easily create an EBS-backed image from the AWS management console by right-clicking the target instance in the instance listing. One item on the contextual menu that appears is Create Image (EBS AMI). The AWS management console handles everything from there. During the image creationprocess, AWS stops the instance from which you’re creating the image inorder to have a stable instance. If you have additional EBS volumes attached to the instance, AWS creates (and attaches) fresh volumes to the new image; however, there’s no data on those volumes. (For more on the AWS managementconsole, see Chapter 3.)You can also use a set of AWS API tools to create an EBS-backed image. You install the tools on the instance from which you want to create a new image and then execute the ec2-create-image command. This is possible only in Linux-based instances; Windows-based EBS-backed images can be created only via the AWS management console. This command requires that the access key and secret access key be available to confirm your right to create the image.
Creating S3-backed images
The process of creating S3-backed images can be more complex than creating EBS-backed images, depending on whether you’re creating a Windows-based or Linux-based image.For Windows-based images, you follow a process similar to the one outlined in the preceding section for Windows-based EBS-backed images. You star twith an S3-backed Windows instance, extend it by installing additional softwarecomponents, and then right-click the instance in the AWS managementconsole and select Bundle Instance (Instance Store AMI) from the menuthat appears. S3-backed images (Amazon refers to them as instance-stored images) require a separate bucket — in fact, it can be a top-level, uniquelynamed bucket in your account or a folder within a top-level bucket — in your S3 account in which to store the Windows AMI, so you must create that bucket before beginning the image creation process. After you select Bundle Instance (Instance Store AMI) from the contextual menu, the AWS managementconsole completes the bundling process.