1 Answer
- Newest
- Most votes
- Most comments
1
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.
answered a year ago
Relevant content
- Accepted Answerasked a year ago
- Accepted Answerasked 3 months ago
- What's the difference between Lambda function execution role permissions and invocation permissions?AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago