Created
November 21, 2020 18:24
-
-
Save bmwitcher/65966653d35795f2439a0c8bfa027a4c to your computer and use it in GitHub Desktop.
start ec2 lambda python code
This file contains hidden or 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
# 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