Skip to content

(iam): how to create combined managed policy? #12111

@akefirad

Description

@akefirad

Is there a way to create combined policy using CDK?

Use Case

I'm trying to import (AWS or customer) managed policies into a new managed policy. I couldn't find any info regarding how to do this.

This is needed to cope with size limitations (e.g. number of policies in a group).

Other

As a workaround I did this:

const myManagedPolicy = ...;
const myCombinedPolicy = new iam.ManagedPolicy(this, "MyCombinedPolicy", {
  statements: myManagedPolicy.document.toJSON().Statement.map((s: any) => iam.PolicyStatement.fromJson(s))
});

This works fine, but has two limitations:

  1. I can't assign any SID to the statements.
  2. It won't work with AWS managed policy (since they're of type iam.IManagedPolicy)

Metadata

Metadata

Assignees

Labels

@aws-cdk/aws-iamRelated to AWS Identity and Access Managementfeature-requestA feature should be added or improved.needs-triageThis issue or PR still needs to be triaged.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions