Created
March 23, 2020 06:17
-
-
Save PrashantBhatasana/e3adee6cfea99c36dc8387a0a3018b54 to your computer and use it in GitHub Desktop.
This is lambda function with python language that Terminate ec2 instence.
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
import boto3 | |
import time | |
region = 'us-XXXX-2' | |
instances = ['i-XXXXXXXXXXXXXXXX'] | |
def lambda_handler(event, context): | |
ec2 = boto3.client('ec2', region_name=region) | |
ec2.terminate_instances(InstanceIds=instances) | |
print 'Terminate your instances: ' + str(instances) | |
return "Build server Terminate..." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment