AWS Fundamentals Logo
AWS Fundamentals
L1 ConstructAWS::Lightsail::Database

CfnDatabase

The `AWS::Lightsail::Database` resource specifies an Amazon Lightsail database.

Import

import { CfnDatabase } from 'aws-cdk-lib/aws-lightsail';

Or use the module namespace:

import * as lightsail from 'aws-cdk-lib/aws-lightsail';
// lightsail.CfnDatabase

Properties

Configuration passed to the constructor as CfnDatabaseProps.

masterDatabaseNameRequired
string

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) .

masterUsernameRequired
string

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) .

relationalDatabaseBlueprintIdRequired
string

The blueprint ID for the database (for example, `mysql_8_0` ).

relationalDatabaseBundleIdRequired
string

The bundle ID for the database (for example, `medium_1_0` ).

relationalDatabaseNameRequired
string

The name of the instance.

availabilityZoneOptional
string

The Availability Zone for the database.

backupRetentionOptional
boolean | IResolvable

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` .

caCertificateIdentifierOptional
string

The certificate associated with the database.

masterUserPasswordOptional
string

The password for the primary user of the database. The password can include any printable ASCII character except the following: /, ", or

preferredBackupWindowOptional
string

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

preferredMaintenanceWindowOptional
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` .

publiclyAccessibleOptional
boolean | IResolvable

A Boolean value indicating whether the database is accessible to anyone on the internet.

relationalDatabaseParametersOptional
IResolvable | IResolvable | RelationalDatabaseParameterProperty[]

An array of parameters for the database.

rotateMasterUserPasswordOptional
boolean | IResolvable

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.

tagsOptional
CfnTag[]

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.

CloudFormation Resource

This L1 construct maps directly to the following CloudFormation resource type.

Learn AWS the Practical Way

Our bi-weekly newsletter teaches hands-on AWS fundamentals. No certification fluff - just practical knowledge.

Subscribe to Newsletter