Skip to content

Instantly share code, notes, and snippets.

@fabiojwalter
Created June 23, 2021 00:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fabiojwalter/2567b9201b35b34bf26f800c1c4fb488 to your computer and use it in GitHub Desktop.
Save fabiojwalter/2567b9201b35b34bf26f800c1c4fb488 to your computer and use it in GitHub Desktop.
AWS - Lambda - EC2 Stop
import boto3
region = 'us-west-2'
instances = ['i-091e60ababe060baa']
def lambda_handler(event, context):
ec2 = boto3.client('ec2', region_name=region)
ec2.stop_instances(InstanceIds=instances)
print 'Desligando a Instancia: ' + str(instances)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment