Can I use AWS CloudFormation with a custom AMI?

5.3k views Asked by At

I want to use an AMI that have not been created from a snapshot. The AMI was created using a virtual machine and then I used CLI tools to create the instance and the AMI.

This instance have installed cloud-init. Could I use this AMI to create instances using cloudformation? Do I need to install more software to use that service?

Thanks!

3

There are 3 answers

0
Sébastien Stormacq On

Should you plan to use Cloudformation:Init inside your template to add additional configuration when your instance will start, be sure to install cfn tools as well (cfn-init, cfn-hup, cfn-signal...)

More details about Cloudformation:Init : http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-init.html

How to install cfn helper scripts : http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-helper-scripts-reference.html

0
E.J. Brennan On

Yes, definitely, that is a very common use case:

Amazon Web Services (AWS) publishes many Amazon Machine Images (AMIs) that contain common software configurations for public use. In addition, the AWS developer community has published many custom AMIs. You can also create your own custom AMIs so that you can quickly and easily start new instances that have everything you need for your application. For example, if your application is a website or a web service, your AMI could include a web server, the associated static content, and the code for the dynamic pages. After you launch an instance with this AMI, your application is running and ready to accept requests.

https://s3.amazonaws.com/cloudformation-examples/BoostrappingApplicationsWithAWSCloudFormation.pdf

0
Paul Dunlop On

Yes.

When you are specifying the instance in the cloud formation script you can use "ImageID": "" <- put in the AMI ID

ImageId

Provides the unique ID of the Amazon Machine Image (AMI) that was assigned during registration.

Required: Yes

Type: String

Update requires: Replacement