Skip to content

Instantly share code, notes, and snippets.

@fabiojwalter
Created June 23, 2021 00:45
Show Gist options
  • Save fabiojwalter/d2a072b0fb1462cbfc1d34d1370f1219 to your computer and use it in GitHub Desktop.
Save fabiojwalter/d2a072b0fb1462cbfc1d34d1370f1219 to your computer and use it in GitHub Desktop.
AWS - Lambda - EC2 Start
import boto3
region = 'us-west-2'
def lambda_handler(event, context):
instances = event['instance']
ec2 = boto3.client('ec2', region_name=region)
ec2.start_instances(InstanceIds=[instances])
print 'stopped your instances: ' + str(instances)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment