Skip to content

carteakey/aws-terminate-untagged-instances

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

aws-terminate-untagged-instances

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).

AWS Services used

  • SES
  • EC2
  • Lambda
  • DynamoDB
  • EventBridge

Deployment Steps:

  • Create a lambda function terminate-untagged-instances Lambda function setup
  • Upload both .py files in the function

Configuration

  • Go to Configuration > General Configuration > Increase timeout to 1 min.

  • Go to Configuration > Permissions > Execution Role

    • Add below policies to the role Role setup
  • Create a dynamoDB table terminate-untagged-instances with partition key - instanceId (String)

  • Create a EventBridge rule to schedule the lambda function every 1 hour.

About

Simple python lambda function to terminate all EC2 instances that don’t follow a tagging criteria.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages