Skip to content
v2.277.0

Experimental

@aws-cdk/aws-elasticache-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

PasswordUserProps Struct ​

Properties for defining an ElastiCache user with password authentication.

Example ​

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
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
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();
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") }
});
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 ​

accessControlAccessControlaccess_controlAccessControlaccessControlAccessControlAccessControlAccessControlAccessControlAccessControl required #
Access control configuration for the user.
engineoptionalUserEngineengineoptionalUserEngineengineoptionalUserEngineEngineoptionalUserEngineEngineoptionalUserEngine #
The engine type for the user.

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

Enum options: UserEngine.VALKEY, UserEngine.REDIS.

passwordsSecretValue[]passwordstyping.List[SecretValue]passwordsList<SecretValue>PasswordsSecretValue[]Passwords*[]SecretValue required #
The passwords for the user.

Password authentication requires using 1-2 passwords.

userIdstringuser_idstruserIdStringUserIdstringUserId*string required #
The ID of the user.
userNameoptionalstringuser_nameoptionalstruserNameoptionalStringUserNameoptionalstringUserNameoptional*string #
The name of the user.

Default: Same as userId.