> **Experimental**
>
> `@aws-cdk/aws-elasticache-alpha` is an [**experimental**](https://docs.aws.amazon.com/cdk/api/stability.html) (alpha) package: its API may change in any release, without a major version bump.
# PasswordUserProps

Properties for defining an ElastiCache user with password authentication.

Extends: [UserBaseProps](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-elasticache-alpha.UserBaseProps.html)
Used as props by: [PasswordUser](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-elasticache-alpha.PasswordUser.html)

- Stability: [Experimental](https://docs.aws.amazon.com/cdk/api/stability.html)
- Source: [`lib/password-user.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/@aws-cdk/aws-elasticache-alpha/lib/password-user.ts#L17)

## Example

TypeScript:

```ts
const user = new elasticache.PasswordUser(this, 'User', {
  // set user engine
  engine: elasticache.UserEngine.VALKEY,

  // set user id
  userId: 'my-user-id',

  // set access string
  accessControl: elasticache.AccessControl.fromAccessString("on ~* +@all"),

  // set username
  userName: 'my-user-name',

  // set up to two passwords
  passwords: [
    // "SecretIdForPassword" is the secret id for the password
    SecretValue.secretsManager('SecretIdForPassword'),
    // "AnotherSecretIdForPassword" is the secret id for the password
    SecretValue.secretsManager('AnotherSecretIdForPassword'),
  ],
});
```

Python:

```python
user = elasticache.PasswordUser(self, "User",
    # set user engine
    engine=elasticache.UserEngine.VALKEY,

    # set user id
    user_id="my-user-id",

    # set access string
    access_control=elasticache.AccessControl.from_access_string("on ~* +@all"),

    # set username
    user_name="my-user-name",

    # set up to two passwords
    passwords=[
        # "SecretIdForPassword" is the secret id for the password
        SecretValue.secrets_manager("SecretIdForPassword"),
        # "AnotherSecretIdForPassword" is the secret id for the password
        SecretValue.secrets_manager("AnotherSecretIdForPassword")
    ]
)
```

Java:

```java
PasswordUser user = PasswordUser.Builder.create(this, "User")
        // set user engine
        .engine(UserEngine.VALKEY)

        // set user id
        .userId("my-user-id")

        // set access string
        .accessControl(AccessControl.fromAccessString("on ~* +@all"))

        // set username
        .userName("my-user-name")

        // set up to two passwords
        .passwords(List.of(SecretValue.secretsManager("SecretIdForPassword"), SecretValue.secretsManager("AnotherSecretIdForPassword")))
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.AWS.ElastiCache.Alpha
var user = new PasswordUser(this, "User", new PasswordUserProps {
    // set user engine
    Engine = UserEngine.VALKEY,

    // set user id
    UserId = "my-user-id",

    // set access string
    AccessControl = AccessControl.FromAccessString("on ~* +@all"),

    // set username
    UserName = "my-user-name",

    // set up to two passwords
    Passwords = new [] { SecretValue.SecretsManager("SecretIdForPassword"), SecretValue.SecretsManager("AnotherSecretIdForPassword") }
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdkelasticachealpha/v2
user := elasticache.NewPasswordUser(this, jsii.String("User"), &PasswordUserProps{
	// set user engine
	Engine: elasticache.UserEngine_VALKEY(),

	// set user id
	UserId: jsii.String("my-user-id"),

	// set access string
	AccessControl: elasticache.AccessControl_FromAccessString(jsii.String("on ~* +@all")),

	// set username
	UserName: jsii.String("my-user-name"),

	// set up to two passwords
	Passwords: []SecretValue{
		awscdk.SecretValue_SecretsManager(jsii.String("SecretIdForPassword")),
		awscdk.SecretValue_*SecretsManager(jsii.String("AnotherSecretIdForPassword")),
	},
})
```

## Properties

- `accessControl`: [AccessControl](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-elasticache-alpha.AccessControl.html) (required) — Access control configuration for the user.

- `engine`: [UserEngine](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-elasticache-alpha.UserEngine.html) — The engine type for the user.

  **Default:** UserEngine.REDIS for NoPasswordUser, UserEngine.VALKEY for all other user types.

  Enum options: UserEngine.VALKEY, UserEngine.REDIS.

- `passwords`: [SecretValue](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.SecretValue.html)[] (required) — The passwords for the user.

  Password authentication requires using 1-2 passwords.

- `userId`: string (required) — The ID of the user.

- `userName`: string — The name of the user.

  **Default:** Same as userId.
