0

My question here is I will be creating the EC2 instance using the cloud formation template, while deleting the stack I want to create the AMI of that EC2. I found some articles about how to create the AMI using the Cloud Formation template. But before deleting the stack How can I send signal to Cloud Formation to create AMI before deleting that EC2 instance. For RDS, EBS volumes and some others have Deletion policy, where we can specify Retain or snapshot to leave the resource to be deleted or create snapshot of that respectively. Can someone help with this or you if you find some article point me to that direction.

Thank you.

Srinivas
  • 11
  • 1
  • It seems to me that you're using the wrong tool for the job. Take a look at [EC2 Image Builder](https://docs.aws.amazon.com/imagebuilder/latest/userguide/what-is-image-builder.html). – Parsifal Feb 15 '22 at 13:48
  • My use case is I am trying to create a STG env, after doing the deployment into those EC2, I need AMI's of those. For the future, while spinning up STG env I want to use those AMI's. In the stack there are some other resources getting created not only EC2. In this case Ec2 image builder will not help I guess. – Srinivas Feb 15 '22 at 14:18
  • I am totally new to creating custom resources. I need to work more on that. Haven't figure out the solution to my use case yet. – Srinivas Feb 16 '22 at 20:00
  • I suggest trying developing it and making new question with the code. In the meantime, as you know what you have to do now, acceptance of my answer would be appreciated. – Marcin Feb 17 '22 at 04:37
  • No Marchin, I didn't look at that I will work on that this week. I Appreciate for concern about helping me. Thank you, I will message if I stuck somewhere and I need your help. – Srinivas Feb 18 '22 at 15:44

1 Answers1

1

You need a custom resource which responds to the following events:

Supports the Create, Read, Update, Delete, and List (CRUDL) operations

Marcin
  • 215,873
  • 14
  • 235
  • 294