AWS::Lightsail::Database - AWS CloudFormation

AWS::Lightsail::Database

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

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

{ "Type" : "AWS::Lightsail::Database", "Properties" : { "AvailabilityZone" : String, "BackupRetention" : Boolean, "CaCertificateIdentifier" : String, "MasterDatabaseName" : String, "MasterUsername" : String, "MasterUserPassword" : String, "PreferredBackupWindow" : String, "PreferredMaintenanceWindow" : String, "PubliclyAccessible" : Boolean, "RelationalDatabaseBlueprintId" : String, "RelationalDatabaseBundleId" : String, "RelationalDatabaseName" : String, "RelationalDatabaseParameters" : [ RelationalDatabaseParameter, ... ], "RotateMasterUserPassword" : Boolean, "Tags" : [ Tag, ... ] } }

Properties

AvailabilityZone

The Availability Zone for the database.

Required: No

Type: String

Minimum: 1

Maximum: 255

Update requires: Updates are not supported.

BackupRetention

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.

Required: No

Type: Boolean

Update requires: Some interruptions

CaCertificateIdentifier

The certificate associated with the database.

Required: No

Type: String

Update requires: No interruption

MasterDatabaseName

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, MySQL 5.7, and MySQL 8.0.

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, PostgreSQL 10, PostgreSQL 11, and PostgreSQL 12.

Required: Yes

Type: String

Minimum: 1

Maximum: 255

Update requires: Updates are not supported.

MasterUsername

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, MySQL 5.7, or MySQL 8.0.

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, PostgreSQL 10, PostgreSQL 11, and PostgreSQL 12.

Required: Yes

Type: String

Minimum: 1

Maximum: 63

Update requires: Updates are not supported.

MasterUserPassword

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

Note

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

MySQL

Constraints: Must contain 8-41 characters.

PostgreSQL

Constraints: Must contain 8-128 characters.

Required: No

Type: String

Minimum: 1

Maximum: 63

Update requires: No interruption

PreferredBackupWindow

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

Required: No

Type: String

Update requires: No interruption

PreferredMaintenanceWindow

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.

Required: No

Type: String

Update requires: No interruption

PubliclyAccessible

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

Required: No

Type: Boolean

Update requires: No interruption

RelationalDatabaseBlueprintId

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

Required: Yes

Type: String

Minimum: 1

Maximum: 255

Update requires: Updates are not supported.

RelationalDatabaseBundleId

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

Required: Yes

Type: String

Minimum: 1

Maximum: 255

Update requires: Updates are not supported.

RelationalDatabaseName

The name of the instance.

Required: Yes

Type: String

Pattern: \w[\w\-]*\w

Minimum: 2

Maximum: 255

Update requires: Replacement

RelationalDatabaseParameters

An array of parameters for the database.

Required: No

Type: Array of RelationalDatabaseParameter

Update requires: No interruption

RotateMasterUserPassword

A Boolean value indicating whether to change the primary user password to a new, strong password generated by Lightsail.

Note

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

Required: No

Type: Boolean

Update requires: No interruption

Tags

An array of key-value pairs to apply to this resource.

For more information, see Tag in the AWS CloudFormation User Guide.

Note

The Value of Tags is optional for Lightsail resources.

Required: No

Type: Array of Tag

Update requires: No interruption

Return values

Ref

When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns a unique identifier for this resource.

Fn::GetAtt

The Fn::GetAtt intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information about using the Fn::GetAtt intrinsic function, see Fn::GetAtt.

DatabaseArn

The Amazon Resource Name (ARN) of the database (for example, arn:aws:lightsail:us-east-2:123456789101:RelationalDatabase/244ad76f-8aad-4741-809f-12345EXAMPLE).

Remarks

Availability Zone

You can specify an Availability Zone when you perform a create database request. If you don’t specify one, the database is created in the same Availability Zone as the last Lightsail resource you created.

Database updates

All database update operations are performed immediately. However, parameter updates are applied based on the ApplyMethod value for the specific parameter being updated.