Package software.amazon.awscdk.services.iam
AWS Identity and Access Management Construct Library
---
AWS CDK v1 has reached End-of-Support on 2023-06-01. This package is no longer being updated, and users should migrate to AWS CDK v2.
For more information on how to migrate, see the Migrating to AWS CDK v2 guide.
Define a role and add permissions to it. This will automatically create and attach an IAM policy to the role:
Role role = Role.Builder.create(this, "MyRole") .assumedBy(new ServicePrincipal("sns.amazonaws.com")) .build(); role.addToPolicy(PolicyStatement.Builder.create() .resources(List.of("*")) .actions(List.of("lambda:InvokeFunction")) .build());
Define a policy and attach it to groups, users and roles. Note that it is possible to attach
the policy either by calling xxx.attachInlinePolicy(policy)
or policy.attachToXxx(xxx)
.
User user = User.Builder.create(this, "MyUser").password(SecretValue.unsafePlainText("1234")).build(); Group group = new Group(this, "MyGroup"); Policy policy = new Policy(this, "MyPolicy"); policy.attachToUser(user); group.attachInlinePolicy(policy);
Managed policies can be attached using xxx.addManagedPolicy(ManagedPolicy.fromAwsManagedPolicyName(policyName))
:
Group group = new Group(this, "MyGroup"); group.addManagedPolicy(ManagedPolicy.fromAwsManagedPolicyName("AdministratorAccess"));
Granting permissions to resources
Many of the AWS CDK resources have grant*
methods that allow you to grant other resources access to that resource. As an example, the following code gives a Lambda function write permissions (Put, Update, Delete) to a DynamoDB table.
Function fn; Table table; table.grantWriteData(fn);
The more generic grant
method allows you to give specific permissions to a resource:
Function fn; Table table; table.grant(fn, "dynamodb:PutItem");
The grant*
methods accept an IGrantable
object. This interface is implemented by IAM principlal resources (groups, users and roles) and resources that assume a role such as a Lambda function, EC2 instance or a Codebuild project.
You can find which grant*
methods exist for a resource in the AWS CDK API Reference.
Roles
Many AWS resources require Roles to operate. These Roles define the AWS API calls an instance or other AWS service is allowed to make.
Creating Roles and populating them with the right permissions Statements is a necessary but tedious part of setting up AWS infrastructure. In order to help you focus on your business logic, CDK will take care of creating roles and populating them with least-privilege permissions automatically.
All constructs that require Roles will create one for you if don't specify
one at construction time. Permissions will be added to that role
automatically if you associate the construct with other constructs from the
AWS Construct Library (for example, if you tell an AWS CodePipeline to trigger
an AWS Lambda Function, the Pipeline's Role will automatically get
lambda:InvokeFunction
permissions on that particular Lambda Function),
or if you explicitly grant permissions using grant
functions (see the
previous section).
Opting out of automatic permissions management
You may prefer to manage a Role's permissions yourself instead of having the CDK automatically manage them for you. This may happen in one of the following cases:
- You don't like the permissions that CDK automatically generates and want to substitute your own set.
- The least-permissions policy that the CDK generates is becoming too big for IAM to store, and you need to add some wildcards to keep the policy size down.
To prevent constructs from updating your Role's policy, pass the object
returned by myRole.withoutPolicyUpdates()
instead of myRole
itself.
For example, to have an AWS CodePipeline not automatically add the required permissions to trigger the expected targets, do the following:
Role role = Role.Builder.create(this, "Role") .assumedBy(new ServicePrincipal("codepipeline.amazonaws.com")) // custom description if desired .description("This is a custom role...") .build(); Pipeline.Builder.create(this, "Pipeline") // Give the Pipeline an immutable view of the Role .role(role.withoutPolicyUpdates()) .build(); // You now have to manage the Role policies yourself role.addToPolicy(PolicyStatement.Builder.create() .actions(List.of()) .resources(List.of()) .build());
Using existing roles
If there are Roles in your account that have already been created which you
would like to use in your CDK application, you can use Role.fromRoleArn
to
import them, as follows:
IRole role = Role.fromRoleArn(this, "Role", "arn:aws:iam::123456789012:role/MyExistingRole", FromRoleArnOptions.builder() // Set 'mutable' to 'false' to use the role as-is and prevent adding new // policies to it. The default is 'true', which means the role may be // modified as part of the deployment. .mutable(false) .build());
Configuring an ExternalId
If you need to create Roles that will be assumed by third parties, it is generally a good idea to require an ExternalId
to assume them. Configuring
an ExternalId
works like this:
Role role = Role.Builder.create(this, "MyRole") .assumedBy(new AccountPrincipal("123456789012")) .externalIds(List.of("SUPPLY-ME")) .build();
Principals vs Identities
When we say Principal, we mean an entity you grant permissions to. This
entity can be an AWS Service, a Role, or something more abstract such as "all
users in this account" or even "all users in this organization". An
Identity is an IAM representing a single IAM entity that can have
a policy attached, one of Role
, User
, or Group
.
IAM Principals
When defining policy statements as part of an AssumeRole policy or as part of a
resource policy, statements would usually refer to a specific IAM principal
under Principal
.
IAM principals are modeled as classes that derive from the iam.PolicyPrincipal
abstract class. Principal objects include principal type (string) and value
(array of string), optional set of conditions and the action that this principal
requires when it is used in an assume role policy document.
To add a principal to a policy statement you can either use the abstract
statement.addPrincipal
, one of the concrete addXxxPrincipal
methods:
addAwsPrincipal
,addArnPrincipal
ornew ArnPrincipal(arn)
for{ "AWS": arn }
addAwsAccountPrincipal
ornew AccountPrincipal(accountId)
for{ "AWS": account-arn }
addServicePrincipal
ornew ServicePrincipal(service)
for{ "Service": service }
addAccountRootPrincipal
ornew AccountRootPrincipal()
for{ "AWS": { "Ref: "AWS::AccountId" } }
addCanonicalUserPrincipal
ornew CanonicalUserPrincipal(id)
for{ "CanonicalUser": id }
addFederatedPrincipal
ornew FederatedPrincipal(federated, conditions, assumeAction)
for{ "Federated": arn }
and a set of optional conditions and the assume role action to use.addAnyPrincipal
ornew AnyPrincipal
for{ "AWS": "*" }
If multiple principals are added to the policy statement, they will be merged together:
PolicyStatement statement = new PolicyStatement(); statement.addServicePrincipal("cloudwatch.amazonaws.com"); statement.addServicePrincipal("ec2.amazonaws.com"); statement.addArnPrincipal("arn:aws:boom:boom");
Will result in:
{ "Principal": { "Service": [ "cloudwatch.amazonaws.com", "ec2.amazonaws.com" ], "AWS": "arn:aws:boom:boom" } }
The CompositePrincipal
class can also be used to define complex principals, for example:
Role role = Role.Builder.create(this, "MyRole") .assumedBy(new CompositePrincipal( new ServicePrincipal("ec2.amazonaws.com"), new AccountPrincipal("1818188181818187272"))) .build();
The PrincipalWithConditions
class can be used to add conditions to a
principal, especially those that don't take a conditions
parameter in their
constructor. The principal.withConditions()
method can be used to create a
PrincipalWithConditions
from an existing principal, for example:
PrincipalBase principal = new AccountPrincipal("123456789000").withConditions(Map.of("StringEquals", Map.of("foo", "baz")));
NOTE: If you need to define an IAM condition that uses a token (such as a deploy-time attribute of another resource) in a JSON map key, use
CfnJson
to render this condition. See this test for an example.
The WebIdentityPrincipal
class can be used as a principal for web identities like
Cognito, Amazon, Google or Facebook, for example:
WebIdentityPrincipal principal = new WebIdentityPrincipal("cognito-identity.amazonaws.com", Map.of( "StringEquals", Map.of("cognito-identity.amazonaws.com:aud", "us-east-2:12345678-abcd-abcd-abcd-123456"), "ForAnyValue:StringLike", Map.of("cognito-identity.amazonaws.com:amr", "unauthenticated")));
If your identity provider is configured to assume a Role with session
tags, you
need to call .withSessionTags()
to add the required permissions to the Role's
policy document:
Role.Builder.create(this, "Role") .assumedBy(new WebIdentityPrincipal("cognito-identity.amazonaws.com", Map.of( "StringEquals", Map.of( "cognito-identity.amazonaws.com:aud", "us-east-2:12345678-abcd-abcd-abcd-123456"), "ForAnyValue:StringLike", Map.of( "cognito-identity.amazonaws.com:amr", "unauthenticated"))).withSessionTags()) .build();
Parsing JSON Policy Documents
The PolicyDocument.fromJson
and PolicyStatement.fromJson
static methods can be used to parse JSON objects. For example:
Map<String, Object> policyDocument = Map.of( "Version", "2012-10-17", "Statement", List.of(Map.of( "Sid", "FirstStatement", "Effect", "Allow", "Action", List.of("iam:ChangePassword"), "Resource", "*"), Map.of( "Sid", "SecondStatement", "Effect", "Allow", "Action", "s3:ListAllMyBuckets", "Resource", "*"), Map.of( "Sid", "ThirdStatement", "Effect", "Allow", "Action", List.of("s3:List*", "s3:Get*"), "Resource", List.of("arn:aws:s3:::confidential-data", "arn:aws:s3:::confidential-data/*"), "Condition", Map.of("Bool", Map.of("aws:MultiFactorAuthPresent", "true"))))); PolicyDocument customPolicyDocument = PolicyDocument.fromJson(policyDocument); // You can pass this document as an initial document to a ManagedPolicy // or inline Policy. ManagedPolicy newManagedPolicy = ManagedPolicy.Builder.create(this, "MyNewManagedPolicy") .document(customPolicyDocument) .build(); Policy newPolicy = Policy.Builder.create(this, "MyNewPolicy") .document(customPolicyDocument) .build();
Permissions Boundaries
Permissions
Boundaries
can be used as a mechanism to prevent privilege esclation by creating new
Role
s. Permissions Boundaries are a Managed Policy, attached to Roles or
Users, that represent the maximum set of permissions they can have. The
effective set of permissions of a Role (or User) will be the intersection of
the Identity Policy and the Permissions Boundary attached to the Role (or
User). Permissions Boundaries are typically created by account
Administrators, and their use on newly created Role
s will be enforced by
IAM policies.
It is possible to attach Permissions Boundaries to all Roles created in a construct tree all at once:
// Directly apply the boundary to a Role you create Role role; // Apply the boundary to an Role that was implicitly created for you Function fn; // Remove a Permissions Boundary that is inherited, for example from the Stack level CustomResource customResource; // This imports an existing policy. IManagedPolicy boundary = ManagedPolicy.fromManagedPolicyArn(this, "Boundary", "arn:aws:iam::123456789012:policy/boundary"); // This creates a new boundary ManagedPolicy boundary2 = ManagedPolicy.Builder.create(this, "Boundary2") .statements(List.of( PolicyStatement.Builder.create() .effect(Effect.DENY) .actions(List.of("iam:*")) .resources(List.of("*")) .build())) .build(); PermissionsBoundary.of(role).apply(boundary); PermissionsBoundary.of(fn).apply(boundary); // Apply the boundary to all Roles in a stack PermissionsBoundary.of(this).apply(boundary); PermissionsBoundary.of(customResource).clear();
OpenID Connect Providers
OIDC identity providers are entities in IAM that describe an external identity provider (IdP) service that supports the OpenID Connect (OIDC) standard, such as Google or Salesforce. You use an IAM OIDC identity provider when you want to establish trust between an OIDC-compatible IdP and your AWS account. This is useful when creating a mobile app or web application that requires access to AWS resources, but you don't want to create custom sign-in code or manage your own user identities. For more information about this scenario, see [About Web Identity Federation] and the relevant documentation in the [Amazon Cognito Identity Pools Developer Guide].
The following examples defines an OpenID Connect provider. Two client IDs (audiences) are will be able to send authentication requests to https://openid/connect.
OpenIdConnectProvider provider = OpenIdConnectProvider.Builder.create(this, "MyProvider") .url("https://openid/connect") .clientIds(List.of("myclient1", "myclient2")) .build();
You can specify an optional list of thumbprints
. If not specified, the
thumbprint of the root certificate authority (CA) will automatically be obtained
from the host as described
here.
Once you define an OpenID connect provider, you can use it with AWS services that expect an IAM OIDC provider. For example, when you define an Amazon Cognito identity pool you can reference the provider's ARN as follows:
import software.amazon.awscdk.services.cognito.*; OpenIdConnectProvider myProvider; CfnIdentityPool.Builder.create(this, "IdentityPool") .openIdConnectProviderArns(List.of(myProvider.getOpenIdConnectProviderArn())) // And the other properties for your identity pool .allowUnauthenticatedIdentities(false) .build();
The OpenIdConnectPrincipal
class can be used as a principal used with a OpenIdConnectProvider
, for example:
OpenIdConnectProvider provider = OpenIdConnectProvider.Builder.create(this, "MyProvider") .url("https://openid/connect") .clientIds(List.of("myclient1", "myclient2")) .build(); OpenIdConnectPrincipal principal = new OpenIdConnectPrincipal(provider);
SAML provider
An IAM SAML 2.0 identity provider is an entity in IAM that describes an external identity provider (IdP) service that supports the SAML 2.0 (Security Assertion Markup Language 2.0) standard. You use an IAM identity provider when you want to establish trust between a SAML-compatible IdP such as Shibboleth or Active Directory Federation Services and AWS, so that users in your organization can access AWS resources. IAM SAML identity providers are used as principals in an IAM trust policy.
SamlProvider.Builder.create(this, "Provider") .metadataDocument(SamlMetadataDocument.fromFile("/path/to/saml-metadata-document.xml")) .build();
The SamlPrincipal
class can be used as a principal with a SamlProvider
:
SamlProvider provider = SamlProvider.Builder.create(this, "Provider") .metadataDocument(SamlMetadataDocument.fromFile("/path/to/saml-metadata-document.xml")) .build(); SamlPrincipal principal = new SamlPrincipal(provider, Map.of( "StringEquals", Map.of( "SAML:iss", "issuer")));
When creating a role for programmatic and AWS Management Console access, use the SamlConsolePrincipal
class:
SamlProvider provider = SamlProvider.Builder.create(this, "Provider") .metadataDocument(SamlMetadataDocument.fromFile("/path/to/saml-metadata-document.xml")) .build(); Role.Builder.create(this, "Role") .assumedBy(new SamlConsolePrincipal(provider)) .build();
Users
IAM manages users for your AWS account. To create a new user:
User user = new User(this, "MyUser");
To import an existing user by name with path:
IUser user = User.fromUserName(this, "MyImportedUserByName", "johnsmith");
To import an existing user by ARN:
IUser user = User.fromUserArn(this, "MyImportedUserByArn", "arn:aws:iam::123456789012:user/johnsmith");
To import an existing user by attributes:
IUser user = User.fromUserAttributes(this, "MyImportedUserByAttributes", UserAttributes.builder() .userArn("arn:aws:iam::123456789012:user/johnsmith") .build());
Access Keys
The ability for a user to make API calls via the CLI or an SDK is enabled by the user having an access key pair. To create an access key:
User user = new User(this, "MyUser"); AccessKey accessKey = AccessKey.Builder.create(this, "MyAccessKey").user(user).build();
You can force CloudFormation to rotate the access key by providing a monotonically increasing serial
property. Simply provide a higher serial value than any number used previously:
User user = new User(this, "MyUser"); AccessKey accessKey = AccessKey.Builder.create(this, "MyAccessKey").user(user).serial(1).build();
An access key may only be associated with a single user and cannot be "moved" between users. Changing the user associated with an access key replaces the access key (and its ID and secret value).
Groups
An IAM user group is a collection of IAM users. User groups let you specify permissions for multiple users.
Group group = new Group(this, "MyGroup");
To import an existing group by ARN:
IGroup group = Group.fromGroupArn(this, "MyImportedGroupByArn", "arn:aws:iam::account-id:group/group-name");
To import an existing group by name with path:
IGroup group = Group.fromGroupName(this, "MyImportedGroupByName", "group-name");
To add a user to a group (both for a new and imported user/group):
User user = new User(this, "MyUser"); // or User.fromUserName(stack, 'User', 'johnsmith'); Group group = new Group(this, "MyGroup"); // or Group.fromGroupArn(stack, 'Group', 'arn:aws:iam::account-id:group/group-name'); user.addToGroup(group); // or group.addUser(user);
Features
- Policy name uniqueness is enforced. If two policies by the same name are attached to the same principal, the attachment will fail.
- Policy names are not required - the CDK logical ID will be used and ensured to be unique.
- Policies are validated during synthesis to ensure that they have actions, and that policies attached to IAM principals specify relevant resources, while policies attached to resources specify which IAM principals they apply to.
-
ClassDescriptionDefine a new IAM Access Key.A fluent builder for
AccessKey
.Properties for defining an IAM access key.A builder forAccessKeyProps
An implementation forAccessKeyProps
Valid statuses for an IAM Access Key.Specify AWS account ID as the principal entity in a policy to delegate authority to the account.Use the AWS account into which a stack is deployed as the principal entity in a policy.Result of callingaddToPrincipalPolicy
.A builder forAddToPrincipalPolicyResult
An implementation forAddToPrincipalPolicyResult
Result of calling addToResourcePolicy.A builder forAddToResourcePolicyResult
An implementation forAddToResourcePolicyResult
Deprecated.A principal representing all AWS identities in all accounts.Specify a principal by the Amazon Resource Name (ARN).A policy principal for canonicalUserIds - useful for S3 bucket policies that use Origin Access identities.A CloudFormationAWS::IAM::AccessKey
.A fluent builder forCfnAccessKey
.Properties for defining aCfnAccessKey
.A builder forCfnAccessKeyProps
An implementation forCfnAccessKeyProps
A CloudFormationAWS::IAM::Group
.A fluent builder forCfnGroup
.Contains information about an attached policy.A builder forCfnGroup.PolicyProperty
An implementation forCfnGroup.PolicyProperty
Properties for defining aCfnGroup
.A builder forCfnGroupProps
An implementation forCfnGroupProps
A CloudFormationAWS::IAM::InstanceProfile
.A fluent builder forCfnInstanceProfile
.Properties for defining aCfnInstanceProfile
.A builder forCfnInstanceProfileProps
An implementation forCfnInstanceProfileProps
A CloudFormationAWS::IAM::ManagedPolicy
.A fluent builder forCfnManagedPolicy
.Properties for defining aCfnManagedPolicy
.A builder forCfnManagedPolicyProps
An implementation forCfnManagedPolicyProps
A CloudFormationAWS::IAM::OIDCProvider
.A fluent builder forCfnOIDCProvider
.Properties for defining aCfnOIDCProvider
.A builder forCfnOIDCProviderProps
An implementation forCfnOIDCProviderProps
A CloudFormationAWS::IAM::Policy
.A fluent builder forCfnPolicy
.Properties for defining aCfnPolicy
.A builder forCfnPolicyProps
An implementation forCfnPolicyProps
A CloudFormationAWS::IAM::Role
.A fluent builder forCfnRole
.Contains information about an attached policy.A builder forCfnRole.PolicyProperty
An implementation forCfnRole.PolicyProperty
Properties for defining aCfnRole
.A builder forCfnRoleProps
An implementation forCfnRoleProps
A CloudFormationAWS::IAM::SAMLProvider
.A fluent builder forCfnSAMLProvider
.Properties for defining aCfnSAMLProvider
.A builder forCfnSAMLProviderProps
An implementation forCfnSAMLProviderProps
A CloudFormationAWS::IAM::ServerCertificate
.A fluent builder forCfnServerCertificate
.Properties for defining aCfnServerCertificate
.A builder forCfnServerCertificateProps
An implementation forCfnServerCertificateProps
A CloudFormationAWS::IAM::ServiceLinkedRole
.A fluent builder forCfnServiceLinkedRole
.Properties for defining aCfnServiceLinkedRole
.A builder forCfnServiceLinkedRoleProps
An implementation forCfnServiceLinkedRoleProps
A CloudFormationAWS::IAM::User
.A fluent builder forCfnUser
.Creates a password for the specified user, giving the user the ability to access AWS services through the AWS Management Console .A builder forCfnUser.LoginProfileProperty
An implementation forCfnUser.LoginProfileProperty
Contains information about an attached policy.A builder forCfnUser.PolicyProperty
An implementation forCfnUser.PolicyProperty
Properties for defining aCfnUser
.A builder forCfnUserProps
An implementation forCfnUserProps
A CloudFormationAWS::IAM::UserToGroupAddition
.A fluent builder forCfnUserToGroupAddition
.Properties for defining aCfnUserToGroupAddition
.A builder forCfnUserToGroupAdditionProps
An implementation forCfnUserToGroupAdditionProps
A CloudFormationAWS::IAM::VirtualMFADevice
.A fluent builder forCfnVirtualMFADevice
.Properties for defining aCfnVirtualMFADevice
.A builder forCfnVirtualMFADeviceProps
An implementation forCfnVirtualMFADeviceProps
Basic options for a grant operation.A builder forCommonGrantOptions
An implementation forCommonGrantOptions
Helper class for working withIComparablePrincipal
s.Composite dependable.Represents a principal that has multiple types of principals.The Effect element of an IAM policy.Principal entity that represents a federated identity provider such as Amazon Cognito, that can be used to provide temporary security credentials to users who have been authenticated.Options allowing customizing the behavior ofinvalid @link
Role.fromRoleArn
A builder forFromRoleArnOptions
An implementation forFromRoleArnOptions
Result of a grant() operation.Options for a grant operation to both identity and resource.A builder forGrantOnPrincipalAndResourceOptions
An implementation forGrantOnPrincipalAndResourceOptions
Options for a grant operation that only applies to principals.A builder forGrantOnPrincipalOptions
An implementation forGrantOnPrincipalOptions
Options for a grant operation.A builder forGrantWithResourceOptions
An implementation forGrantWithResourceOptions
An IAM Group (collection of IAM users) lets you specify permissions for multiple users, which can make it easier to manage permissions for those users.A fluent builder forGroup
.Properties for defining an IAM group.A builder forGroupProps
An implementation forGroupProps
Represents an IAM Access Key.Internal default implementation forIAccessKey
.A proxy class which represents a concrete javascript instance of this type.A type of principal that has more control over its own representation in AssumeRolePolicyDocuments.Internal default implementation forIAssumeRolePrincipal
.A proxy class which represents a concrete javascript instance of this type.Interface for principals that can be compared.Internal default implementation forIComparablePrincipal
.A proxy class which represents a concrete javascript instance of this type.Any object that has an associated principal that a permission can be granted to.Internal default implementation forIGrantable
.A proxy class which represents a concrete javascript instance of this type.Represents an IAM Group.Internal default implementation forIGroup
.A proxy class which represents a concrete javascript instance of this type.A construct that represents an IAM principal, such as a user, group or role.Internal default implementation forIIdentity
.A proxy class which represents a concrete javascript instance of this type.A managed policy.Internal default implementation forIManagedPolicy
.A proxy class which represents a concrete javascript instance of this type.Represents an IAM OpenID Connect provider.Internal default implementation forIOpenIdConnectProvider
.A proxy class which represents a concrete javascript instance of this type.Represents an IAM Policy.Internal default implementation forIPolicy
.A proxy class which represents a concrete javascript instance of this type.Represents a logical IAM principal.Internal default implementation forIPrincipal
.A proxy class which represents a concrete javascript instance of this type.A resource with a resource policy that can be added to.Internal default implementation forIResourceWithPolicy
.A proxy class which represents a concrete javascript instance of this type.A Role object.Internal default implementation forIRole
.A proxy class which represents a concrete javascript instance of this type.A SAML provider.Internal default implementation forISamlProvider
.A proxy class which represents a concrete javascript instance of this type.Represents an IAM user.Internal default implementation forIUser
.A proxy class which represents a concrete javascript instance of this type.An IAM role that only gets attached to the construct tree once it gets used, not before.A fluent builder forLazyRole
.Properties for defining a LazyRole.A builder forLazyRoleProps
An implementation forLazyRoleProps
Managed policy.A fluent builder forManagedPolicy
.Properties for defining an IAM managed policy.A builder forManagedPolicyProps
An implementation forManagedPolicyProps
A principal that represents a federated identity provider as from a OpenID Connect provider.IAM OIDC identity providers are entities in IAM that describe an external identity provider (IdP) service that supports the OpenID Connect (OIDC) standard, such as Google or Salesforce.A fluent builder forOpenIdConnectProvider
.Initialization properties forOpenIdConnectProvider
.A builder forOpenIdConnectProviderProps
An implementation forOpenIdConnectProviderProps
A principal that represents an AWS Organization.Modify the Permissions Boundaries of Users and Roles in a construct tree.The AWS::IAM::Policy resource associates an IAM policy with IAM users, roles, or groups.A fluent builder forPolicy
.A PolicyDocument is a collection of statements.A fluent builder forPolicyDocument
.Properties for a new PolicyDocument.A builder forPolicyDocumentProps
An implementation forPolicyDocumentProps
Properties for defining an IAM inline policy document.A builder forPolicyProps
An implementation forPolicyProps
Represents a statement in an IAM policy document.A fluent builder forPolicyStatement
.Interface for creating a policy statement.A builder forPolicyStatementProps
An implementation forPolicyStatementProps
Base class for policy principals.A collection of the fields in a PolicyStatement that can be used to identify a principal.An IAM principal with additional conditions specifying when the policy is in effect.IAM Role.A fluent builder forRole
.Properties for defining an IAM Role.A builder forRoleProps
An implementation forRoleProps
Principal entity that represents a SAML federated identity provider for programmatic and AWS Management Console access.A SAML metadata document.Principal entity that represents a SAML federated identity provider.A SAML provider.A fluent builder forSamlProvider
.Properties for a SAML provider.A builder forSamlProviderProps
An implementation forSamlProviderProps
An IAM principal that represents an AWS service (i.e.A fluent builder forServicePrincipal
.Options for a service principal.A builder forServicePrincipalOpts
An implementation forServicePrincipalOpts
Enables session tags on role assumptions from a principal.A principal that uses a literal '*' in the IAM JSON language.A principal for use in resources that need to have a role but it's unknown.A fluent builder forUnknownPrincipal
.Properties for an UnknownPrincipal.A builder forUnknownPrincipalProps
An implementation forUnknownPrincipalProps
Define a new IAM user.A fluent builder forUser
.Represents a user defined outside of this stack.A builder forUserAttributes
An implementation forUserAttributes
Properties for defining an IAM user.A builder forUserProps
An implementation forUserProps
A principal that represents a federated identity provider as Web Identity such as Cognito, Amazon, Facebook, Google, etc.Options for thewithoutPolicyUpdates()
modifier of a Role.A builder forWithoutPolicyUpdatesOptions
An implementation forWithoutPolicyUpdatesOptions
AnyPrincipal