add_user_to_group

IAM.Client.add_user_to_group(**kwargs)

Adds the specified user to the specified group.

See also: AWS API Documentation

Request Syntax

response = client.add_user_to_group(
    GroupName='string',
    UserName='string'
)
Parameters
  • GroupName (string) --

    [REQUIRED]

    The name of the group to update.

    This parameter allows (through its regex pattern ) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-

  • UserName (string) --

    [REQUIRED]

    The name of the user to add.

    This parameter allows (through its regex pattern ) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-

Returns

None

Exceptions

  • IAM.Client.exceptions.NoSuchEntityException
  • IAM.Client.exceptions.LimitExceededException
  • IAM.Client.exceptions.ServiceFailureException

Examples

The following command adds an IAM user named Bob to the IAM group named Admins:

response = client.add_user_to_group(
    GroupName='Admins',
    UserName='Bob',
)

print(response)

Expected Output:

{
    'ResponseMetadata': {
        '...': '...',
    },
}