Skip to content

Instantly share code, notes, and snippets.

@wshihadeh
Created April 15, 2020 06:34
Show Gist options
  • Save wshihadeh/2b5b751a1c5d2bd4f405eeafe0a0b1b9 to your computer and use it in GitHub Desktop.
Save wshihadeh/2b5b751a1c5d2bd4f405eeafe0a0b1b9 to your computer and use it in GitHub Desktop.
AWS policy
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