Create AMI using Cloudformation

1

Morning to you all

Is there a way to create an AMI from an existing EC2 instance using Cloudformation.

I cant find anything in the official docs

1개 답변
1
수락된 답변

To answer specifically, yes it can be done. However, it would require using a Custom Resource which essentially calls the CreateImage Api and so really you would just be wrapping an API call in CloudFormation and I would suggest this might be an anti-pattern so whilst possible I would say perhaps don't do it this way.

Instead you might want to consider using Systems Manage Automation there is a AWS provided document that creates an AMI from an existing instance, the document is called AWS-CreateImage and details of it can be found here.

Assuming your plan is to automate the creation of images there is also a related post here

profile pictureAWS
danjhd
답변함 4달 전
profile picture
전문가
Kallu
검토됨 4달 전
  • @danjhd thank you for that, looks like it will do what I am after. does creating an AMI this way capture multiple volumes?

  • I have just run a test using that SSM Doc and it included all the EBS volumes attached to the instance at the time in the Image,

  • Instead, you might want to consider using Systems Manage Automation there is an AWS-provided document that creates an AMI from an existing instance, the document is called AWS-CreateImage and details of it can be found here. :

    by following this process how I can integrate in the cloud formation template to automatically create the AMI ,

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠