A simple python serverless lambda function which would terminate all EC2 instances which don’t follow a tagging criteria. (A free tier AWS account would work).
- SES
- EC2
- Lambda
- DynamoDB
- EventBridge
-
Go to Configuration > General Configuration > Increase timeout to 1 min.
-
Go to Configuration > Permissions > Execution Role
-
Create a dynamoDB table terminate-untagged-instances with partition key - instanceId (String)
-
Create a EventBridge rule to schedule the lambda function every 1 hour.