import boto3 region = 'ap-northeast-2' instances = ['i-0b8d61b56a3baf918'] ec2 = boto3.client('ec2', region_name=region) def lambda_handler(event, context): ec2.stop_instances(InstanceIds=instances) print('Stopped instances: ' + str(instances))