Skip to content

Instantly share code, notes, and snippets.

@wheller
Created April 16, 2022 09:24
Show Gist options
  • Select an option

  • Save wheller/203661e001630241b9d173edbb37d017 to your computer and use it in GitHub Desktop.

Select an option

Save wheller/203661e001630241b9d173edbb37d017 to your computer and use it in GitHub Desktop.
Permissions required to deploy a Lambda function via CDK. Replace "Lambda-Metrics-" with the prefix of your function, or remove it to grant unlimited function names.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "CDKCloudFormationStacks",
"Effect": "Allow",
"Action": [
"cloudformation:DescribeStacks"
],
"Resource": "arn:aws:cloudformation:*:*:stack/CDKToolkit/*"
},
{
"Sid": "CDKBucketAccess",
"Effect": "Allow",
"Action": [
"s3:GetBucketLocation",
"s3:GetObject",
"s3:ListBucket",
"s3:PutObject"
],
"Resource": "arn:aws:s3:::cdk-*"
},
{
"Sid": "CDKBucketList",
"Effect": "Allow",
"Action": "s3:ListAllMyBuckets",
"Resource": "*"
},
{
"Sid": "CloudFormationStacks",
"Effect": "Allow",
"Action": [
"cloudformation:CreateChangeSet",
"cloudformation:DescribeChangeSet",
"cloudformation:DescribeStackEvents",
"cloudformation:DescribeStacks",
"cloudformation:ExecuteChangeSet"
],
"Resource": "arn:aws:cloudformation:*:*:stack/Lambda-Metrics-*/*"
},
{
"Sid": "CreateRoles",
"Effect": "Allow",
"Action": [
"iam:AttachRolePolicy",
"iam:CreateRole",
"iam:GetRole",
"iam:GetRolePolicy",
"iam:ListRoleTags",
"iam:PassRole",
"iam:PutRolePolicy",
"iam:TagRole"
],
"Resource": "arn:aws:iam::*:role/Lambda-Metrics-*"
},
{
"Sid": "Lambda",
"Effect": "Allow",
"Action": [
"lambda:CreateFunction",
"lambda:GetFunction"
],
"Resource": "arn:aws:lambda:*:*:function:Lambda-Metrics-*"
},
{
"Sid": "DeleteRolesOnlyRequiredToRollbackIfFailed",
"Effect": "Allow",
"Action": [
"iam:DeleteRole",
"iam:DeleteRolePolicy",
"iam:DetachRolePolicy"
],
"Resource": "arn:aws:iam::*:role/Lambda-Metrics-*"
},
{
"Sid": "DeleteLambdaOnlyRequiredToRollbackIfFailed",
"Effect": "Allow",
"Action": [
"lambda:DeleteFunction"
],
"Resource": "arn:aws:lambda:*:*:function:Lambda-Metrics-*"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment