feat(iam): seed the managed policies CDK bootstrap and the scenario stacks attach (#2064)

* feat(iam): seed the managed policies CDK bootstrap and the scenario stacks attach

Four AWS-managed policies were missing from the catalog, and each surfaced the
same way: "Policy arn:aws:iam::aws:policy/<name> does not exist" reported on the
role that consumed it, rolling the whole stack back several resources from the
cause.

- AWSCloudFormationReadOnlyAccess — attached by the roles `cdk bootstrap`
  creates, so CDKToolkit rolled back and no CDK application could deploy at all.
- AmazonAthenaFullAccess, AmazonRedshiftFullAccess, AmazonS3TablesReadOnlyAccess
  — attached by the QA roles the aws-bench ec2-multiregion scenario deploys.

Supersedes #2059, which carried only the first of the four.

* fix(iam): drop the AWSCloudFormationReadOnlyAccess duplicate landed by #2057

* fix(iam): match the AWS-published descriptions for two seeded policies

Both verified with iam:GetPolicy against real AWS.

AWSCloudFormationReadOnlyAccess was seeded by #2057 as "Provides read only
access to Cloud Control and CloudFormation."; AWS returns "Provides access
to AWS CloudFormation via the AWS Management Console."

AmazonS3TablesReadOnlyAccess said "Provides read-only access to Amazon S3
Tables."; AWS returns "Provides read only access to all S3 table buckets."
This commit is contained in:
lex00 authored and GitHub committed 2026-08-04 21:37:20 -05:00
1 parent 7ade290312
commit 43aea0983d
2 files changed
+21 -1

No files matched your search

@@ -57,13 +57,22 @@ final class AwsManagedPolicies {
new ManagedPolicyDef("AWSLambdaFullAccess", "/",
"Provides full access to Lambda, S3, DynamoDB, CloudWatch Metrics and Logs."),
new ManagedPolicyDef("AWSCloudFormationReadOnlyAccess", "/",
"Provides read only access to Cloud Control and CloudFormation."),
"Provides access to AWS CloudFormation via the AWS Management Console."),
new ManagedPolicyDef("AWSCloudFormationFullAccess", "/",
"Provides full access to AWS CloudFormation."),
new ManagedPolicyDef("AWSXRayDaemonWriteAccess", "/",
"Allows write permissions to the AWS X-Ray daemon."),
new ManagedPolicyDef("AmazonElasticFileSystemClientFullAccess", "/",
"Provides root client access to an Amazon EFS file system."),
// Attached by the roles `cdk bootstrap` creates, so without it the CDKToolkit stack
// rolls back and no CDK app can be deployed.
new ManagedPolicyDef("AmazonAthenaFullAccess", "/",
"Provide full access to Amazon Athena and scoped access to the dependencies "
+ "needed to enable querying, writing results, and data management."),
new ManagedPolicyDef("AmazonRedshiftFullAccess", "/",
"Provides full access to Amazon Redshift via the AWS Management Console."),
new ManagedPolicyDef("AmazonS3TablesReadOnlyAccess", "/",
"Provides read only access to all S3 table buckets."),
new ManagedPolicyDef("AWSCloudTrail_FullAccess", "/",
"Provides full access to AWS CloudTrail."),
new ManagedPolicyDef("AWSCloudTrail_ReadOnlyAccess", "/",
@@ -590,6 +590,17 @@ class IamServiceTest {
assertTrue(admin.getPolicyId().startsWith("ANPA"));
assertEquals("v1", admin.getDefaultVersionId());
// Referenced by the roles `cdk bootstrap` and the aws-bench scenario stacks create.
// A missing entry surfaces as "Policy <arn> does not exist" on the consuming role,
// which rolls the whole stack back.
for (String name : new String[] {
"AWSCloudFormationReadOnlyAccess", "AmazonAthenaFullAccess",
"AmazonRedshiftFullAccess", "AmazonS3TablesReadOnlyAccess" }) {
IamPolicy seeded = iamService.getPolicy("arn:aws:iam::aws:policy/" + name);
assertEquals(name, seeded.getPolicyName());
assertEquals("/", seeded.getPath());
}
IamPolicy lambda = iamService.getPolicy(
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole");
assertEquals("AWSLambdaBasicExecutionRole", lambda.getPolicyName());