Skip to content

Instantly share code, notes, and snippets.

@bmwitcher
Created November 21, 2020 18:24
Show Gist options
  • Save bmwitcher/65966653d35795f2439a0c8bfa027a4c to your computer and use it in GitHub Desktop.
Save bmwitcher/65966653d35795f2439a0c8bfa027a4c to your computer and use it in GitHub Desktop.
start ec2 lambda python code
# Starts the EC2 instances
import boto3
region = 'us-east-1'
instances = ['i-12345', 'i-2345']
ec2 = boto3.client('ec2', region_name=region)
def lambda_handler(event, context):
ec2.start_instances(InstanceIds=instances)
print('started your instances: ' + str(instances))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment