interface CustomizeRolesOptions
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.IAM.CustomizeRolesOptions |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsiam#CustomizeRolesOptions |
Java | software.amazon.awscdk.services.iam.CustomizeRolesOptions |
Python | aws_cdk.aws_iam.CustomizeRolesOptions |
TypeScript (source) | aws-cdk-lib » aws_iam » CustomizeRolesOptions |
Options for customizing IAM role creation.
Example
declare const app: App;
const stack = new Stack(app, 'MyStack');
iam.Role.customizeRoles(this, {
usePrecreatedRoles: {
'MyStack/MyLambda/ServiceRole': 'my-role-name',
}
});
Properties
| Name | Type | Description |
|---|---|---|
| prevent | boolean | Whether or not to synthesize the resource into the CFN template. |
| use | { [string]: string } | A list of precreated IAM roles to substitute for roles that CDK is creating. |
preventSynthesis?
Type:
boolean
(optional, default: true)
Whether or not to synthesize the resource into the CFN template.
Set this to false if you still want to create the resources and
you also want to create the policy report.
usePrecreatedRoles?
Type:
{ [string]: string }
(optional, default: there are no precreated roles. Synthesis will fail if preventSynthesis=true)
A list of precreated IAM roles to substitute for roles that CDK is creating.
The constructPath can be either a relative or absolute path
from the scope that customizeRoles is used on to the role being created.
Example
declare const app: App;
const stack = new Stack(app, 'MyStack');
new iam.Role(stack, 'MyRole', {
assumedBy: new iam.AccountPrincipal('1111111111'),
});
iam.Role.customizeRoles(stack, {
usePrecreatedRoles: {
// absolute path
'MyStack/MyRole': 'my-precreated-role-name',
// or relative path from `stack`
'MyRole': 'my-precreated-role',
},
});

.NET
Go
Java
Python
TypeScript (