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
| { | |
| "Id": "Policy1550810272864", | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { | |
| "Sid": "Stmt1550810271230", | |
| "Action": [ | |
| "s3:GetObject", | |
| "s3:PutObject" |
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
| provider "aws" { | |
| region = "us-west-2" | |
| } | |
| resource "aws_s3_bucket_policy" "b" { | |
| bucket = "mytests3bucket" | |
| policy = <<POLICY | |
| { | |
| "Version": "2012-10-17", | |
| "Id": "MYBUCKETPOLICY", |
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
| { | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { | |
| "Sid": "VisualEditor0", | |
| "Effect": "Deny", | |
| "Action": "cloudtrail:StopLogging", | |
| "Resource": "arn:aws:cloudtrail:us-west-2:123456789:trail/mytestcloudtrail" | |
| } | |
| ] |
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
| { | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { | |
| "Sid": "VisualEditor0", | |
| "Effect": "Allow", | |
| "Action": [ | |
| "logs:CreateLogStream", | |
| "logs:PutLogEvents" | |
| ], |
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 json | |
| import boto3 | |
| import sys | |
| print('Loading function') | |
| """ Function to define Lambda Handler """ | |
| def lambda_handler(event, context): | |
| try: | |
| client = boto3.client('cloudtrail') |
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
| { | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { | |
| "Effect": "Allow", | |
| "Action": [ | |
| "logs:CreateLogGroup", | |
| "logs:CreateLogStream", | |
| "logs:PutLogEvents" | |
| ], |
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 | |
| # Enter the region your instances are in. Include only the region without specifying Availability Zone; e.g., 'us-east-1' | |
| region = 'XX-XXXXX-X' | |
| # Enter your instances here: ex. ['X-XXXXXXXX', 'X-XXXXXXXX'] | |
| instances = ['X-XXXXXXXX'] | |
| def lambda_handler(event, context): | |
| ec2 = boto3.client('ec2', region_name=region) | |
| ec2.stop_instances(InstanceIds=instances) | |
| print 'stopped your instances: ' + str(instances) |
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
| { | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { | |
| "Sid": "", | |
| "Effect": "Allow", | |
| "Principal": { | |
| "Service": "lambda.amazonaws.com" | |
| }, | |
| "Action": "sts:AssumeRole" |
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 | |
| # Enter the region your instances are in. Include only the region without specifying Availability Zone; e.g.; 'us-east-1' | |
| region = 'XX-XXXXX-X' | |
| # Enter your instances here: ex. ['X-XXXXXXXX', 'X-XXXXXXXX'] | |
| instances = ['X-XXXXXXXX'] | |
| def lambda_handler(event, context): | |
| ec2 = boto3.client('ec2', region_name=region) | |
| ec2.start_instances(InstanceIds=instances) | |
| print 'started your instances: ' + str(instances) |
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
| { | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { | |
| "Sid": "VisualEditor0", | |
| "Effect": "Deny", | |
| "Action": [ | |
| "ec2:ModifyTransitGatewayVpcAttachment", | |
| "ec2:DeleteTransitGatewayVpcAttachment", | |
| "ec2:DetachClassicLinkVpc", |