CreateUserCommand

For Valkey engine version 7.2 onwards and Redis OSS 6.0 to 7.1: Creates a user. For more information, see Using Role Based Access Control (RBAC) .

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { ElastiCacheClient, CreateUserCommand } from "@aws-sdk/client-elasticache"; // ES Modules import
// const { ElastiCacheClient, CreateUserCommand } = require("@aws-sdk/client-elasticache"); // CommonJS import
const client = new ElastiCacheClient(config);
const input = { // CreateUserMessage
  UserId: "STRING_VALUE", // required
  UserName: "STRING_VALUE", // required
  Engine: "STRING_VALUE", // required
  Passwords: [ // PasswordListInput
    "STRING_VALUE",
  ],
  AccessString: "STRING_VALUE", // required
  NoPasswordRequired: true || false,
  Tags: [ // TagList
    { // Tag
      Key: "STRING_VALUE",
      Value: "STRING_VALUE",
    },
  ],
  AuthenticationMode: { // AuthenticationMode
    Type: "password" || "no-password-required" || "iam",
    Passwords: [
      "STRING_VALUE",
    ],
  },
};
const command = new CreateUserCommand(input);
const response = await client.send(command);
// { // User
//   UserId: "STRING_VALUE",
//   UserName: "STRING_VALUE",
//   Status: "STRING_VALUE",
//   Engine: "STRING_VALUE",
//   MinimumEngineVersion: "STRING_VALUE",
//   AccessString: "STRING_VALUE",
//   UserGroupIds: [ // UserGroupIdList
//     "STRING_VALUE",
//   ],
//   Authentication: { // Authentication
//     Type: "password" || "no-password" || "iam",
//     PasswordCount: Number("int"),
//   },
//   ARN: "STRING_VALUE",
// };

CreateUserCommand Input

See CreateUserCommandInput for more details

Parameter
Type
Description
AccessString
Required
string | undefined

Access permissions string used for this user.

Engine
Required
string | undefined

The options are valkey or redis.

UserId
Required
string | undefined

The ID of the user.

UserName
Required
string | undefined

The username of the user.

AuthenticationMode
AuthenticationMode | undefined

Specifies how to authenticate the user.

NoPasswordRequired
boolean | undefined

Indicates a password is not required for this user.

Passwords
string[] | undefined

Passwords used for this user. You can create up to two passwords for each user.

Tags
Tag[] | undefined

A list of tags to be added to this resource. A tag is a key-value pair. A tag key must be accompanied by a tag value, although null is accepted.

CreateUserCommand Output

See CreateUserCommandOutput for details

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
ARN
string | undefined

The Amazon Resource Name (ARN) of the user.

AccessString
string | undefined

Access permissions string used for this user.

Authentication
Authentication | undefined

Denotes whether the user requires a password to authenticate.

Engine
string | undefined

The options are valkey or redis.

MinimumEngineVersion
string | undefined

The minimum engine version required, which is Redis OSS 6.0

Status
string | undefined

Indicates the user status. Can be "active", "modifying" or "deleting".

UserGroupIds
string[] | undefined

Returns a list of the user group IDs the user belongs to.

UserId
string | undefined

The ID of the user.

UserName
string | undefined

The username of the user.

Throws

Name
Fault
Details
DuplicateUserNameFault
client

A user with this username already exists.

InvalidParameterCombinationException
client

Two or more incompatible parameters were specified.

InvalidParameterValueException
client

The value for a parameter is invalid.

ServiceLinkedRoleNotFoundFault
client

The specified service linked role (SLR) was not found.

TagQuotaPerResourceExceeded
client

The request cannot be processed because it would cause the resource to have more than the allowed number of tags. The maximum number of tags permitted on a resource is 50.

UserAlreadyExistsFault
client

A user with this ID already exists.

UserQuotaExceededFault
client

The quota of users has been exceeded.

ElastiCacheServiceException
Base exception class for all service exceptions from ElastiCache service.