Skip to content

Instantly share code, notes, and snippets.

@wheller
Last active June 2, 2023 14:39
Show Gist options
  • Select an option

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

Select an option

Save wheller/c261c1f0c119f03a652fba19d9522ca6 to your computer and use it in GitHub Desktop.
An AWS Policy granting the access required to bootstrap the AWS CDK in any region.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "CloudFormationStacks",
"Effect": "Allow",
"Action": [
"cloudformation:CreateChangeSet",
"cloudformation:DescribeChangeSet",
"cloudformation:DescribeStackEvents",
"cloudformation:DescribeStacks",
"cloudformation:ExecuteChangeSet"
],
"Resource": "arn:aws:cloudformation:*:*:stack/CDKToolkit/*"
},
{
"Sid": "S3CDKBucket",
"Effect": "Allow",
"Action": [
"s3:CreateBucket",
"s3:GetBucketPublicAccessBlock",
"s3:GetBucketPolicy",
"s3:GetBucketVersioning",
"s3:GetEncryptionConfiguration",
"s3:PutBucketPolicy",
"s3:PutBucketPublicAccessBlock",
"s3:PutBucketVersioning",
"s3:PutEncryptionConfiguration"
],
"Resource": "arn:aws:s3:::cdk-*"
},
{
"Sid": "CreateRoles",
"Effect": "Allow",
"Action": [
"iam:AttachRolePolicy",
"iam:CreateRole",
"iam:GetRole",
"iam:GetRolePolicy",
"iam:ListRoleTags",
"iam:PutRolePolicy",
"iam:TagRole"
],
"Resource": "arn:aws:iam::*:role/cdk-*"
},
{
"Sid": "ECRCreateRepository",
"Effect": "Allow",
"Action": [
"ecr:CreateRepository"
],
"Resource": "*"
},
{
"Sid": "ECRRepository",
"Effect": "Allow",
"Action": [
"ecr:DescribeRepositories",
"ecr:SetRepositoryPolicy"
],
"Resource": "arn:aws:ecr:*:*:repository/cdk-*"
},
{
"Sid": "SystemsManager",
"Effect": "Allow",
"Action": [
"ssm:GetParameters",
"ssm:PutParameter"
],
"Resource": "arn:aws:ssm:*:*:parameter/cdk-bootstrap/*"
},
{
"Sid": "DeleteRolesOnlyRequiredToRollbackIfFailed",
"Effect": "Allow",
"Action": [
"iam:DeleteRole",
"iam:DeleteRolePolicy",
"iam:DetachRolePolicy"
],
"Resource": "arn:aws:iam::*:role/cdk-*"
},
{
"Sid": "DeleteECROnlyRequiredToRollbackIfFailed",
"Effect": "Allow",
"Action": [
"ecr:DeleteRepository"
],
"Resource": "arn:aws:ecr:*:*:repository/cdk-*"
}
]
}
@nebur43
Copy link

nebur43 commented Jun 2, 2023

necesary add ecr:PutLifecyclePolicy

@nebur43
Copy link

nebur43 commented Jun 2, 2023

and "ssm:GetParameter" (without end 's')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment