AWS Fundamentals Logo
AWS Fundamentals
L2 Construct

ManagedPolicy

Managed policy.

Import

import { ManagedPolicy } from 'aws-cdk-lib/aws-iam';

Or use the module namespace:

import * as iam from 'aws-cdk-lib/aws-iam';
// iam.ManagedPolicy

Properties

Configuration passed to the constructor as ManagedPolicyProps.

descriptionOptional
string

A description of the managed policy. Typically used to store information about the permissions defined in the policy. For example, "Grants access to production DynamoDB tables." The policy description is immutable. After a value is assigned, it cannot be changed.

Default: - empty

documentOptional
PolicyDocument

Initial PolicyDocument to use for this ManagedPolicy. If omited, any `PolicyStatement` provided in the `statements` property will be applied against the empty default `PolicyDocument`.

Default: - An empty policy.

groupsOptional
IGroupRef[]

Groups to attach this policy to. You can also use `attachToGroup(group)` to attach this policy to a group.

Default: - No groups.

managedPolicyNameOptional
string

The name of the managed policy. If you specify multiple policies for an entity, specify unique names. For example, if you specify a list of policies for an IAM role, each policy must have a unique name.

Default: - A name is automatically generated.

pathOptional
string

The path for the policy. This parameter allows (through its regex pattern) a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes. In addition, it can contain any ASCII character from the ! (\u0021) through the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercased letters. For more information about paths, see IAM Identifiers in the IAM User Guide.

Default: - "/"

rolesOptional
IRole[]

Roles to attach this policy to. You can also use `attachToRole(role)` to attach this policy to a role.

Default: - No roles.

statementsOptional
PolicyStatement[]

Initial set of permissions to add to this policy document. You can also use `addPermission(statement)` to add permissions later.

Default: - No statements.

usersOptional
IUser[]

Users to attach this policy to. You can also use `attachToUser(user)` to attach this policy to a user.

Default: - No users.

Get the AWS IAM Cheat Sheet

Everything you need to know about AWS IAM on one page. HD quality, print-friendly.

Download Free Infographic