Group

class aws_cdk.aws_iam.Group(scope, id, *, group_name=None, managed_policies=None, path=None)

Bases: aws_cdk.core.Resource

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.

See

https://docs.aws.amazon.com/IAM/latest/UserGuide/id_groups.html

Parameters
  • scope (Construct) –

  • id (str) –

  • group_name (Optional[str]) – A name for the IAM group. For valid values, see the GroupName parameter for the CreateGroup action in the IAM API Reference. If you don’t specify a name, AWS CloudFormation generates a unique physical ID and uses that ID for the group name. If you specify a name, you must specify the CAPABILITY_NAMED_IAM value to acknowledge your template’s capabilities. For more information, see Acknowledging IAM Resources in AWS CloudFormation Templates. Default: Generated by CloudFormation (recommended)

  • managed_policies (Optional[List[IManagedPolicy]]) – A list of managed policies associated with this role. You can add managed policies later using addManagedPolicy(ManagedPolicy.fromAwsManagedPolicyName(policyName)). Default: - No managed policies.

  • path (Optional[str]) – The path to the group. For more information about paths, see IAM Identifiers in the IAM User Guide. Default: /

Methods

add_managed_policy(policy)

Attaches a managed policy to this group.

Parameters

policy (IManagedPolicy) – The managed policy to attach.

Return type

None

add_to_policy(statement)

Add to the policy of this principal.

Parameters

statement (PolicyStatement) –

Return type

bool

add_to_principal_policy(statement)

Adds an IAM statement to the default policy.

Parameters

statement (PolicyStatement) –

Return type

AddToPrincipalPolicyResult

add_user(user)

Adds a user to this group.

Parameters

user (IUser) –

Return type

None

attach_inline_policy(policy)

Attaches a policy to this group.

Parameters

policy (Policy) – The policy to attach.

Return type

None

to_string()

Returns a string representation of this construct.

Return type

str

Attributes

assume_role_action

When this Principal is used in an AssumeRole policy, the action to use.

Return type

str

env

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.

Return type

ResourceEnvironment

grant_principal

The principal to grant permissions to.

Return type

IPrincipal

group_arn

Returns the IAM Group ARN.

Return type

str

group_name

Returns the IAM Group Name.

Return type

str

node

The construct tree node associated with this construct.

Return type

ConstructNode

policy_fragment

Return the policy fragment that identifies this principal in a Policy.

Return type

PrincipalPolicyFragment

principal_account

The AWS account ID of this principal.

Can be undefined when the account is not known (for example, for service principals). Can be a Token - in that case, it’s assumed to be AWS::AccountId.

Return type

Optional[str]

stack

The stack in which this resource is defined.

Return type

Stack

Static Methods

classmethod from_group_arn(scope, id, group_arn)

Import an external group by ARN.

If the imported Group ARN is a Token (such as a CfnParameter.valueAsString or a Fn.importValue()) and the referenced group has a path (like arn:...:group/AdminGroup/NetworkAdmin), the groupName property will not resolve to the correct value. Instead it will resolve to the first path component. We unfortunately cannot express the correct calculation of the full path name as a CloudFormation expression. In this scenario the Group ARN should be supplied without the path in order to resolve the correct group resource.

Parameters
  • scope (Construct) – construct scope.

  • id (str) – construct id.

  • group_arn (str) – the ARN of the group to import (e.g. arn:aws:iam::account-id:group/group-name).

Return type

IGroup

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters

x (Any) –

Return type

bool