serverless-ami-creation-deletion icon indicating copy to clipboard operation
serverless-ami-creation-deletion copied to clipboard

Create AMI of Ec2 instances and delete the AMI after certain period with AWS Lambda🙂.

serverless-ami-creation-deletion

Whenever the lambda function will be triggered, it will create AMI of your ec2 instances and delete the instances whose expiry date is less than the current date.

Configuration

For configuration, the following variables need to be configured in the index.js file,


# specify the region name where you have your ec2 workloads.
region = 'us-east-1'

TagName = 'BackupNode'
SENDER_EMAIL_ID = '[email protected]'
CC_EMAIL_IDS = '[email protected]'
TO_EMAIL_IDS = '[email protected]'
RETENTION_TYPE = 'minutes'
RETENTION_TIME = 10

For more information, please review my blog (http://bit.ly/2Nd5iq6).