1 Answer
- Newest
- Most votes
- Most comments
2
In order to create a Role with the trust policy you have provided with the managed policy attached, you will need to do the following:
// Create a Role that can be assumed by the Lambda's Role.
val role = Role(
stackInstance, "StsChimeChatAssumeRole",
RoleProps.builder()
.assumedBy(ArnPrincipal("arn:aws:iam::<account-number>:role/dev"))
.build()
)
// Add the managed policy to the Role.
role.addManagedPolicy(ManagedPolicy.fromAwsManagedPolicyName("AmazonChimeFullAccess"))
The addToPolicy method allows you to attach IAM policies to a Role, not trust policies.
Relevant content
- asked 6 months ago
