CmdID

CmdID / aws / aws iam

aws iam create-user

Creates a new IAM user for your Amazon Web Services account. AWS CLI reference

4 examples 4 options Its page in the AWS CLI reference

Opens CmdID with your command. It is read in your browser and sent nowhere.

Examples

from aws-cli, each command read by CmdID

Example 1: To create an IAM user

The following create-user example creates an IAM user named Bob in the current account.

aws iam create-user --user-name BobIdentify
--user-nameThe name of the user to create.
Its output
{
    "User": {
        "UserName": "Bob",
        "Path": "/",
        "CreateDate": "2023-06-08T03:20:41.270Z",
        "UserId": "AIDAIOSFODNN7EXAMPLE",
        "Arn": "arn:aws:iam::123456789012:user/Bob"
    }
}

For more information, see Creating an IAM user in your AWS account in the AWS IAM User Guide.

Example 2: To create an IAM user at a specified path

The following create-user example creates an IAM user named Bob at the specified path.

aws iam create-user --user-name Bob --path /division_abc/subdivision_xyz/Identify
--user-nameThe name of the user to create.
--pathThe path for the user name.
Its output
{
    "User": {
        "Path": "/division_abc/subdivision_xyz/",
        "UserName": "Bob",
        "UserId": "AIDAIOSFODNN7EXAMPLE",
        "Arn": "arn:aws:iam::12345678012:user/division_abc/subdivision_xyz/Bob",
        "CreateDate": "2023-05-24T18:20:17+00:00"
    }
}

For more information, see IAM identifiers in the AWS IAM User Guide.

Example 3: To create an IAM user with tags

The following create-user example creates an IAM user named Bob with tags. This example uses the --tags parameter flag with the following JSON-formatted tags: '{"Key": "Department", "Value": "Accounting"}' '{"Key": "Location", "Value": "Seattle"}'. Alternatively, the --tags flag can be used with tags in the shorthand format: 'Key=Department,Value=Accounting Key=Location,Value=Seattle'.

aws iam create-user --user-name Bob --tags '{"Key": "Department", "Value": "Accounting"}' '{"Key": "Location", "Value": "Seattle"}'Identify
--user-nameThe name of the user to create.
--tagsA list of tags that you want to attach to the new user.
Its output
{
    "User": {
        "Path": "/",
        "UserName": "Bob",
        "UserId": "AIDAIOSFODNN7EXAMPLE",
        "Arn": "arn:aws:iam::12345678012:user/Bob",
        "CreateDate": "2023-05-25T17:14:21+00:00",
        "Tags": [
            {
                "Key": "Department",
                "Value": "Accounting"
            },
            {
                "Key": "Location",
                "Value": "Seattle"
            }
        ]
    }
}

For more information, see Tagging IAM users in the AWS IAM User Guide.

Example 4: To create an IAM user with a set permissions boundary

The following create-user example creates an IAM user named Bob with the permissions boundary of AmazonS3FullAccess.

aws iam create-user --user-name Bob --permissions-boundary arn:aws:iam::aws:policy/AmazonS3FullAccessIdentify
--user-nameThe name of the user to create.
--permissions-boundaryThe ARN of the managed policy that is used to set the permissions boundary for the user.
Its output
{
    "User": {
        "Path": "/",
        "UserName": "Bob",
        "UserId": "AIDAIOSFODNN7EXAMPLE",
        "Arn": "arn:aws:iam::12345678012:user/Bob",
        "CreateDate": "2023-05-24T17:50:53+00:00",
        "PermissionsBoundary": {
        "PermissionsBoundaryType": "Policy",
        "PermissionsBoundaryArn": "arn:aws:iam::aws:policy/AmazonS3FullAccess"
        }
    }
}

For more information, see Permissions boundaries for IAM entities in the AWS IAM User Guide.

Options

4 in the AWS CLI reference
--pathThe path for the user name.
--permissions-boundaryThe ARN of the managed policy that is used to set the permissions boundary for the user.
--tagsA list of tags that you want to attach to the new user.
--user-nameThe name of the user to create.