How to create an EC2 instance from a snapshot in cloudformation?

I would like to specify the snapshot identifier that will be used to create the root device image for the EC2 instance created with cloud information. How to do it?

I could only find a way to make the volume from the snapshot, but not use it in the instance.

+4
source share
1 answer

If you want to use the EBS snapshot as the basis for the root disk (EBS volume) for the instance, you must first register the snapshot as AMI (for example, using the ec2 register).

Be sure to specify the correct architecture and kernel (AKI) when registering the snapshot as AMI.

Alternatively, instead of taking a snapshot and registering it as separate steps, you can use the ec2-create-image command / API / console command to take a snapshot and register in one step. It also takes care of choosing the right architecture, kernel, and other parameters.

Once you have an AMI, you can tell CloudFormation to use this AMI when starting a new instance.

+8
source

All Articles