Turn on and off your AWS resources using the Cloud Custodian

Automatically turn on and off your AWS EC2 instances

Cloud Custodian is an open-source tool from Capital One written in python language and comprises of many tools and scripts. It is a powerful tool that allows you to put guard rails in real-time. It is serverless (code runs as a lambda function) and no agent is required. It allows you to define your own rules. It is also referred to as a “Policy as Code”.

In this story, we will discuss how awesome is the Cloud Custodian that helps us save money. It automatically turns off the ec2 instances every night or weekend and turns them back on every morning. In the below example, we have discussed a few scenarios-

# 1 — EC2 off-hours stop

#2 — EC2 off-hours start

# 3— EC2 off-hours enforcement

# 4 — Stop EC2 every Thursday evening at 6 PM (once the vulnerability scanner is done its scanning job)

#5 — Start EC2 every Thursday at 8 AM for the vulnerability scanner.

# 6— EC2 running continuously for last 1 week

Other Stories

Ingesting Cloud Custodian Logs into Sumo Logic

AWS Resource Inventory using Cloud Custodian

Cloud Custodian Policy Health Checks

Cloud Custodian Output Files



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store

Over 18 years of experience in a wide variety of technical domains within information security including information assurance, compliance, and risk management.