Created
June 23, 2021 00:45
-
-
Save fabiojwalter/d2a072b0fb1462cbfc1d34d1370f1219 to your computer and use it in GitHub Desktop.
AWS - Lambda - EC2 Start
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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