Skip to content

Instantly share code, notes, and snippets.

---
AWSTemplateFormatVersion: '2010-09-09'
Description: VPC Template
Parameters:
NameTagPrefix:
Type: String
Description: Prefix of Name tags.
Mappings:
StackConfig:
VPC:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
],
import boto3
import json
client = boto3.client('ec2')
def lambda_handler(event, context):
print 'Start Lambda function(StopEC2 by Tag)'
detail = event['detail']
instance_id = detail['instance-id']