CredentialsBaseOptions

class aws_cdk.aws_rds.CredentialsBaseOptions(*, encryption_key=None, exclude_characters=None, replica_regions=None, secret_name=None)

Bases: object

Base options for creating Credentials.

Parameters
  • encryption_key (Optional[IKey]) – KMS encryption key to encrypt the generated secret. Default: - default master key

  • exclude_characters (Optional[str]) – The characters to exclude from the generated password. Has no effect if {@link password} has been provided. Default: - the DatabaseSecret default exclude character set (” %+~`#$&*()|[]{}:;<>?!’/

  • replica_regions (Optional[Sequence[ReplicaRegion]]) – A list of regions where to replicate this secret. Default: - Secret is not replicated

  • secret_name (Optional[str]) – The name of the secret. Default: - A name is generated by CloudFormation.

ExampleMetadata

infused

Example:

# vpc is of type Vpc

engine = rds.DatabaseInstanceEngine.postgres(version=rds.PostgresEngineVersion.VER_12_3)
my_key = kms.Key(self, "MyKey")

rds.DatabaseInstance(self, "InstanceWithCustomizedSecret",
    engine=engine,
    vpc=vpc,
    credentials=rds.Credentials.from_generated_secret("postgres",
        secret_name="my-cool-name",
        encryption_key=my_key,
        exclude_characters="!&*^#@()",
        replica_regions=[secretsmanager.ReplicaRegion(region="eu-west-1"), secretsmanager.ReplicaRegion(region="eu-west-2")]
    )
)

Attributes

encryption_key

KMS encryption key to encrypt the generated secret.

Default
  • default master key

Return type

Optional[IKey]

exclude_characters

The characters to exclude from the generated password.

Has no effect if {@link password} has been provided.

Default
  • the DatabaseSecret default exclude character set (” %+~`#$&*()|[]{}:;<>?!’/

:: “")

Return type

Optional[str]

replica_regions

A list of regions where to replicate this secret.

Default
  • Secret is not replicated

Return type

Optional[List[ReplicaRegion]]

secret_name

The name of the secret.

Default
  • A name is generated by CloudFormation.

Return type

Optional[str]