# CfnDatabaseProps

Properties for defining a `CfnDatabase`.

Used as props by: [CfnDatabase](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lightsail.CfnDatabase.html)

- Source: Generated at build time

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_lightsail as lightsail } from 'aws-cdk-lib';
const cfnDatabaseProps: lightsail.CfnDatabaseProps = {
  masterDatabaseName: 'masterDatabaseName',
  masterUsername: 'masterUsername',
  relationalDatabaseBlueprintId: 'relationalDatabaseBlueprintId',
  relationalDatabaseBundleId: 'relationalDatabaseBundleId',
  relationalDatabaseName: 'relationalDatabaseName',

  // the properties below are optional
  availabilityZone: 'availabilityZone',
  backupRetention: false,
  caCertificateIdentifier: 'caCertificateIdentifier',
  masterUserPassword: 'masterUserPassword',
  preferredBackupWindow: 'preferredBackupWindow',
  preferredMaintenanceWindow: 'preferredMaintenanceWindow',
  publiclyAccessible: false,
  relationalDatabaseParameters: [{
    allowedValues: 'allowedValues',
    applyMethod: 'applyMethod',
    applyType: 'applyType',
    dataType: 'dataType',
    description: 'description',
    isModifiable: false,
    parameterName: 'parameterName',
    parameterValue: 'parameterValue',
  }],
  rotateMasterUserPassword: false,
  tags: [{
    key: 'key',
    value: 'value',
  }],
};
```

Python:

```python
from aws_cdk import CfnTag
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_lightsail as lightsail

cfn_database_props = lightsail.CfnDatabaseProps(
    master_database_name="masterDatabaseName",
    master_username="masterUsername",
    relational_database_blueprint_id="relationalDatabaseBlueprintId",
    relational_database_bundle_id="relationalDatabaseBundleId",
    relational_database_name="relationalDatabaseName",

    # the properties below are optional
    availability_zone="availabilityZone",
    backup_retention=False,
    ca_certificate_identifier="caCertificateIdentifier",
    master_user_password="masterUserPassword",
    preferred_backup_window="preferredBackupWindow",
    preferred_maintenance_window="preferredMaintenanceWindow",
    publicly_accessible=False,
    relational_database_parameters=[lightsail.CfnDatabase.RelationalDatabaseParameterProperty(
        allowed_values="allowedValues",
        apply_method="applyMethod",
        apply_type="applyType",
        data_type="dataType",
        description="description",
        is_modifiable=False,
        parameter_name="parameterName",
        parameter_value="parameterValue"
    )],
    rotate_master_user_password=False,
    tags=[CfnTag(
        key="key",
        value="value"
    )]
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.lightsail.*;

CfnDatabaseProps cfnDatabaseProps = CfnDatabaseProps.builder()
        .masterDatabaseName("masterDatabaseName")
        .masterUsername("masterUsername")
        .relationalDatabaseBlueprintId("relationalDatabaseBlueprintId")
        .relationalDatabaseBundleId("relationalDatabaseBundleId")
        .relationalDatabaseName("relationalDatabaseName")

        // the properties below are optional
        .availabilityZone("availabilityZone")
        .backupRetention(false)
        .caCertificateIdentifier("caCertificateIdentifier")
        .masterUserPassword("masterUserPassword")
        .preferredBackupWindow("preferredBackupWindow")
        .preferredMaintenanceWindow("preferredMaintenanceWindow")
        .publiclyAccessible(false)
        .relationalDatabaseParameters(List.of(RelationalDatabaseParameterProperty.builder()
                .allowedValues("allowedValues")
                .applyMethod("applyMethod")
                .applyType("applyType")
                .dataType("dataType")
                .description("description")
                .isModifiable(false)
                .parameterName("parameterName")
                .parameterValue("parameterValue")
                .build()))
        .rotateMasterUserPassword(false)
        .tags(List.of(CfnTag.builder()
                .key("key")
                .value("value")
                .build()))
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Lightsail;

var cfnDatabaseProps = new CfnDatabaseProps {
    MasterDatabaseName = "masterDatabaseName",
    MasterUsername = "masterUsername",
    RelationalDatabaseBlueprintId = "relationalDatabaseBlueprintId",
    RelationalDatabaseBundleId = "relationalDatabaseBundleId",
    RelationalDatabaseName = "relationalDatabaseName",

    // the properties below are optional
    AvailabilityZone = "availabilityZone",
    BackupRetention = false,
    CaCertificateIdentifier = "caCertificateIdentifier",
    MasterUserPassword = "masterUserPassword",
    PreferredBackupWindow = "preferredBackupWindow",
    PreferredMaintenanceWindow = "preferredMaintenanceWindow",
    PubliclyAccessible = false,
    RelationalDatabaseParameters = new [] { new RelationalDatabaseParameterProperty {
        AllowedValues = "allowedValues",
        ApplyMethod = "applyMethod",
        ApplyType = "applyType",
        DataType = "dataType",
        Description = "description",
        IsModifiable = false,
        ParameterName = "parameterName",
        ParameterValue = "parameterValue"
    } },
    RotateMasterUserPassword = false,
    Tags = new [] { new CfnTag {
        Key = "key",
        Value = "value"
    } }
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

cfnDatabaseProps := &CfnDatabaseProps{
	MasterDatabaseName: jsii.String("masterDatabaseName"),
	MasterUsername: jsii.String("masterUsername"),
	RelationalDatabaseBlueprintId: jsii.String("relationalDatabaseBlueprintId"),
	RelationalDatabaseBundleId: jsii.String("relationalDatabaseBundleId"),
	RelationalDatabaseName: jsii.String("relationalDatabaseName"),

	// the properties below are optional
	AvailabilityZone: jsii.String("availabilityZone"),
	BackupRetention: jsii.Boolean(false),
	CaCertificateIdentifier: jsii.String("caCertificateIdentifier"),
	MasterUserPassword: jsii.String("masterUserPassword"),
	PreferredBackupWindow: jsii.String("preferredBackupWindow"),
	PreferredMaintenanceWindow: jsii.String("preferredMaintenanceWindow"),
	PubliclyAccessible: jsii.Boolean(false),
	RelationalDatabaseParameters: []interface{}{
		&RelationalDatabaseParameterProperty{
			AllowedValues: jsii.String("allowedValues"),
			ApplyMethod: jsii.String("applyMethod"),
			ApplyType: jsii.String("applyType"),
			DataType: jsii.String("dataType"),
			Description: jsii.String("description"),
			IsModifiable: jsii.Boolean(false),
			ParameterName: jsii.String("parameterName"),
			ParameterValue: jsii.String("parameterValue"),
		},
	},
	RotateMasterUserPassword: jsii.Boolean(false),
	Tags: []CfnTag{
		&CfnTag{
			Key: jsii.String("key"),
			Value: jsii.String("value"),
		},
	},
}
```

## Properties

- `availabilityZone`: string — The Availability Zone for the database.

- `backupRetention`: boolean | [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) — A Boolean value indicating whether automated backup retention is enabled for the database.

  Data Import Mode is enabled when `BackupRetention` is set to `false` , and is disabled when `BackupRetention` is set to `true` .

- `caCertificateIdentifier`: string — The certificate associated with the database.

- `masterDatabaseName`: string (required) — The meaning of this parameter differs according to the database engine you use.

  *MySQL*

  The name of the database to create when the Lightsail database resource is created. If this parameter isn't specified, no database is created in the database resource.

  Constraints:

  - Must contain 1-64 letters or numbers.
  - Must begin with a letter. Subsequent characters can be letters, underscores, or numbers (0-9).
  - Can't be a word reserved by the specified database engine.

  For more information about reserved words in MySQL, see the Keywords and Reserved Words articles for [MySQL 5.6](https://docs.aws.amazon.com/https://dev.mysql.com/doc/refman/5.6/en/keywords.html) , [MySQL 5.7](https://docs.aws.amazon.com/https://dev.mysql.com/doc/refman/5.7/en/keywords.html) , and [MySQL 8.0](https://docs.aws.amazon.com/https://dev.mysql.com/doc/refman/8.0/en/keywords.html) .

  *PostgreSQL*

  The name of the database to create when the Lightsail database resource is created. If this parameter isn't specified, a database named `postgres` is created in the database resource.

  Constraints:

  - Must contain 1-63 letters or numbers.
  - Must begin with a letter. Subsequent characters can be letters, underscores, or numbers (0-9).
  - Can't be a word reserved by the specified database engine.

  For more information about reserved words in PostgreSQL, see the SQL Key Words articles for [PostgreSQL 9.6](https://docs.aws.amazon.com/https://www.postgresql.org/docs/9.6/sql-keywords-appendix.html) , [PostgreSQL 10](https://docs.aws.amazon.com/https://www.postgresql.org/docs/10/sql-keywords-appendix.html) , [PostgreSQL 11](https://docs.aws.amazon.com/https://www.postgresql.org/docs/11/sql-keywords-appendix.html) , and [PostgreSQL 12](https://docs.aws.amazon.com/https://www.postgresql.org/docs/12/sql-keywords-appendix.html) .

- `masterUsername`: string (required) — The name for the primary user.

  *MySQL*

  Constraints:

  - Required for MySQL.
  - Must be 1-16 letters or numbers. Can contain underscores.
  - First character must be a letter.
  - Can't be a reserved word for the chosen database engine.

  For more information about reserved words in MySQL 5.6 or 5.7, see the Keywords and Reserved Words articles for [MySQL 5.6](https://docs.aws.amazon.com/https://dev.mysql.com/doc/refman/5.6/en/keywords.html) , [MySQL 5.7](https://docs.aws.amazon.com/https://dev.mysql.com/doc/refman/5.7/en/keywords.html) , or [MySQL 8.0](https://docs.aws.amazon.com/https://dev.mysql.com/doc/refman/8.0/en/keywords.html) .

  *PostgreSQL*

  Constraints:

  - Required for PostgreSQL.
  - Must be 1-63 letters or numbers. Can contain underscores.
  - First character must be a letter.
  - Can't be a reserved word for the chosen database engine.

  For more information about reserved words in MySQL 5.6 or 5.7, see the Keywords and Reserved Words articles for [PostgreSQL 9.6](https://docs.aws.amazon.com/https://www.postgresql.org/docs/9.6/sql-keywords-appendix.html) , [PostgreSQL 10](https://docs.aws.amazon.com/https://www.postgresql.org/docs/10/sql-keywords-appendix.html) , [PostgreSQL 11](https://docs.aws.amazon.com/https://www.postgresql.org/docs/11/sql-keywords-appendix.html) , and [PostgreSQL 12](https://docs.aws.amazon.com/https://www.postgresql.org/docs/12/sql-keywords-appendix.html) .

- `masterUserPassword`: string — The password for the primary user of the database.

  The password can include any printable ASCII character except the following: /, ", or

- `preferredBackupWindow`: string — The daily time range during which automated backups are created for the database (for example, `16:00-16:30` ).

- `preferredMaintenanceWindow`: string — The weekly time range during which system maintenance can occur for the database, formatted as follows: `ddd:hh24:mi-ddd:hh24:mi` .

  For example, `Tue:17:00-Tue:17:30` .

- `publiclyAccessible`: boolean | [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) — A Boolean value indicating whether the database is accessible to anyone on the internet.

- `relationalDatabaseBlueprintId`: string (required) — The blueprint ID for the database (for example, `mysql_8_0` ).

- `relationalDatabaseBundleId`: string (required) — The bundle ID for the database (for example, `medium_1_0` ).

- `relationalDatabaseName`: string (required) — The name of the instance.

- `relationalDatabaseParameters`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnDatabase.RelationalDatabaseParameterProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lightsail.CfnDatabase.RelationalDatabaseParameterProperty.html)[] — An array of parameters for the database.

- `rotateMasterUserPassword`: boolean | [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) — A Boolean value indicating whether to change the primary user password to a new, strong password generated by Lightsail .

  > The `RotateMasterUserPassword` and `MasterUserPassword` parameters cannot be used together in the same template.

- `tags`: [CfnTag](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.CfnTag.html)[] — An array of key-value pairs to apply to this resource.

  For more information, see [Tag](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-resource-tags.html) in the *AWS CloudFormation User Guide* .

  > The `Value` of `Tags` is optional for Lightsail resources.
