Created
April 15, 2020 06:34
-
-
Save wshihadeh/2b5b751a1c5d2bd4f405eeafe0a0b1b9 to your computer and use it in GitHub Desktop.
AWS policy
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
resource "aws_iam_policy" "stop_start_ec2_policy" { | |
name = "StopStartEC2Policy" | |
path = "/" | |
description = "IAM policy for stop and start EC2 from a lambda" | |
policy = <<EOF | |
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": [ | |
"logs:CreateLogGroup", | |
"logs:CreateLogStream", | |
"logs:PutLogEvents" | |
], | |
"Resource": "arn:aws:logs:*:*:*" | |
}, | |
{ | |
"Effect": "Allow", | |
"Action": [ | |
"ec2:Start*", | |
"ec2:Stop*", | |
"ec2:DescribeInstances*" | |
], | |
"Resource": "*" | |
} | |
] | |
} | |
EOF | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment