Skip to content

Instantly share code, notes, and snippets.

Created September 22, 2020 15:34
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Lambda Function
import boto3
#This simple lambda function is available from AWS with instructions on starting and stopping an instance at regular intervals using Lambda and CloudWatch:
# Enter the region your instances are in. Include only the region without specifying Availability Zone; e.g., 'us-east-1'
region = 'us-east-1'
# Enter your instances here: ex. ['X-XXXXXXXX'] you can comma separate the instance IDs for more than one instance: i.e. ['X-XXXXXXXXX', 'X-XXXXXXXXX"]
instances = ['i-0902effe70a087ae7']
def lambda_handler(event, context):
ec2 = boto3.client('ec2', region_name=region)
Copy link

can we pull multiple instance id's from lambda environment variables ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment