Skip to content

Instantly share code, notes, and snippets.

@PrashantBhatasana
Last active January 10, 2020 07:16
Show Gist options
  • Save PrashantBhatasana/e73270e708c0a652b0fee004e2ef0e13 to your computer and use it in GitHub Desktop.
Save PrashantBhatasana/e73270e708c0a652b0fee004e2ef0e13 to your computer and use it in GitHub Desktop.
This is lambda function with python language that start ec2 instence.
import boto3
import time
region = 'us-XXXX-2'
instances = ['i-XXXXXXXXXXXXXXXX']
def lambda_handler(event, context):
ec2 = boto3.client('ec2', region_name=region)
ec2.start_instances(InstanceIds=instances)
print 'started your instances: ' + str(instances)
return "Build server Starting..."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment