cli: document the necessary permissions needed for a successful deployment with assets
When running cdk deploy with as assumed role, one must configure the exact permissions this role should have. We should document exactly which policies should these role have. For example:
s3:GetBucketLocations3:PutObject*- ...
These are probably just the permissions described here:
https://github.com/aws/aws-cdk/blob/ddd29b485d5e07c0661ce135460b34d9f2b712e9/packages/aws-cdk/lib/api/bootstrap/bootstrap-template.yaml#L289-L313
But we should bubble these up to some documentation source.
This is a 📕 documentation issue
I believe cloudformation:GetTemplate might also be needed, or at least I received errors to that effect.
"s3:PutObject", "s3:GetObject", "s3:ListBucket", "s3:GetBucketLocation" these are required permissions. it should be given to user who will assume the role . even if you give s3:* to role it will not work but if you give these above to the IAM user that is assuming the role, cdk will work
This policy works for our CDK deployment, just put your own account ID in the iam:PassRole resource:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:ListBucket",
"s3:GetObject",
"s3:GetBucketLocation",
"s3:PutObject",
"s3:DeleteObject"
],
"Resource": "arn:aws:s3:::cdk*"
},
{
"Effect": "Allow",
"Action": [
"iam:PassRole"
],
"Resource": "arn:aws:iam::<AWS_ACCOUNT_ID>:role/cdk-*"
},
{
"Effect": "Allow",
"Action": [
"cloudformation:GetTemplate",
"cloudformation:CreateChangeSet",
"cloudformation:DeleteChangeSet",
"cloudformation:DescribeChangeSet",
"cloudformation:DescribeStacks",
"cloudformation:ExecuteChangeSet"
],
"Resource": "arn:aws:cloudformation:*"
}
]
}