Skip to main content

relational_databases

Creates, updates, deletes, gets or lists a relational_databases resource.

Overview

Namerelational_databases
TypeResource
Idaws.lightsail.relational_databases

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringThe unique name of the database resource in Lightsail. (pattern: <code>\w[\w-]*\w</code>)
arnstringThe Amazon Resource Name (ARN) of the database. (pattern: <code>.\S.</code>)
backup_retention_enabledbooleanA Boolean value indicating whether automated backup retention is enabled for the database.
ca_certificate_identifierstringThe certificate associated with the database.
created_atstring (date-time)The timestamp when the database was created. Formatted in Unix time.
enginestringThe database software (for example, MySQL). (pattern: <code>.\S.</code>)
engine_versionstringThe database engine version (for example, 5.7.23). (pattern: <code>.\S.</code>)
hardwareobjectDescribes the hardware of the database.
latest_restorable_timestring (date-time)The latest point in time to which the database can be restored. Formatted in Unix time.
locationobjectThe Region name and Availability Zone where the database is located.
master_database_namestringThe name of the master database created when the Lightsail database resource is created.
master_endpointobjectThe master endpoint for the database.
master_usernamestringThe master user name of the database. (pattern: <code>.\S.</code>)
parameter_apply_statusstringThe status of parameter updates for the database. (pattern: <code>.\S.</code>)
pending_maintenance_actionsarrayDescribes the pending maintenance actions for the database.
pending_modified_valuesobjectDescribes pending database value modifications.
preferred_backup_windowstringThe daily time range during which automated backups are created for the database (for example, 16:00-16:30). (pattern: <code>.\S.</code>)
preferred_maintenance_windowstringThe weekly time range during which system maintenance can occur on the database. In the format ddd:hh24:mi-ddd:hh24:mi. For example, Tue:17:00-Tue:17:30. (pattern: <code>.\S.</code>)
publicly_accessiblebooleanA Boolean value indicating whether the database is publicly accessible.
relational_database_blueprint_idstringThe blueprint ID for the database. A blueprint describes the major engine version of a database. (pattern: <code>.\S.</code>)
relational_database_bundle_idstringThe bundle ID for the database. A bundle describes the performance specifications for your database. (pattern: <code>.\S.</code>)
resource_typestringThe Lightsail resource type for the database (for example, RelationalDatabase). (ContainerService, Instance, StaticIp, KeyPair, InstanceSnapshot, Domain, PeeredVpc, LoadBalancer, LoadBalancerTlsCertificate, Disk, DiskSnapshot, RelationalDatabase, RelationalDatabaseSnapshot, ExportSnapshotRecord, CloudFormationStackRecord, Alarm, ContactMethod, Distribution, Certificate, Bucket)
secondary_availability_zonestringDescribes the secondary Availability Zone of a high availability database. The secondary database is used for failover support of a high availability database.
statestringDescribes the current state of the database. (pattern: <code>.\S.</code>)
support_codestringThe support code for the database. Include this code in your email to support when you have questions about a database in Lightsail. This code enables our support team to look up your Lightsail information more easily.
tagsarrayThe tag keys and optional values for the resource. For more information about tags in Lightsail, see the Amazon Lightsail Developer Guide.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_relational_databaseselectregionReturns information about a specific database in Amazon Lightsail.
get_relational_databasesselectregionReturns information about all of your databases in Amazon Lightsail.
create_relational_databaseinsertregion, relationalDatabaseName, relationalDatabaseBlueprintId, relationalDatabaseBundleId, masterDatabaseName, masterUsernameCreates a new database in Amazon Lightsail. The create relational database operation supports tag-based access control via request tags. For more information, see the Amazon Lightsail Developer Guide.
create_relational_database_from_snapshotinsertregion, relationalDatabaseNameCreates a new database from an existing database snapshot in Amazon Lightsail. You can create a new database from a snapshot in if something goes wrong with your original database, or to change it to a different plan, such as a high availability or standard plan. The create relational database from snapshot operation supports tag-based access control via request tags and resource tags applied to the resource identified by relationalDatabaseSnapshotName. For more information, see the Amazon Lightsail Developer Guide.
update_relational_databaseupdateregion, relationalDatabaseNameAllows the update of one or more attributes of a database in Amazon Lightsail. Updates are applied immediately, or in cases where the updates could result in an outage, are applied during the database's predefined maintenance window. The update relational database operation supports tag-based access control via resource tags applied to the resource identified by relationalDatabaseName. For more information, see the Amazon Lightsail Developer Guide.
delete_relational_databasedeleteregionDeletes a database in Amazon Lightsail. The delete relational database operation supports tag-based access control via resource tags applied to the resource identified by relationalDatabaseName. For more information, see the Amazon Lightsail Developer Guide.
reboot_relational_databaseexecregion, relationalDatabaseNameRestarts a specific database in Amazon Lightsail. The reboot relational database operation supports tag-based access control via resource tags applied to the resource identified by relationalDatabaseName. For more information, see the Amazon Lightsail Developer Guide.
start_relational_databaseexecregion, relationalDatabaseNameStarts a specific database from a stopped state in Amazon Lightsail. To restart a database, use the reboot relational database operation. The start relational database operation supports tag-based access control via resource tags applied to the resource identified by relationalDatabaseName. For more information, see the Amazon Lightsail Developer Guide.
stop_relational_databaseexecregion, relationalDatabaseNameStops a specific database that is currently running in Amazon Lightsail. If you don't manually start your database instance after it has been stopped for seven consecutive days, Amazon Lightsail automatically starts it for you. This action helps ensure that your database instance doesn't fall behind on any required maintenance updates. The stop relational database operation supports tag-based access control via resource tags applied to the resource identified by relationalDatabaseName. For more information, see the Amazon Lightsail Developer Guide.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

Returns information about a specific database in Amazon Lightsail.

SELECT
name,
arn,
backup_retention_enabled,
ca_certificate_identifier,
created_at,
engine,
engine_version,
hardware,
latest_restorable_time,
location,
master_database_name,
master_endpoint,
master_username,
parameter_apply_status,
pending_maintenance_actions,
pending_modified_values,
preferred_backup_window,
preferred_maintenance_window,
publicly_accessible,
relational_database_blueprint_id,
relational_database_bundle_id,
resource_type,
secondary_availability_zone,
state,
support_code,
tags
FROM aws.lightsail.relational_databases
WHERE region = '{{ region }}' -- required
;

INSERT examples

Creates a new database in Amazon Lightsail. The create relational database operation supports tag-based access control via request tags. For more information, see the Amazon Lightsail Developer Guide.

INSERT INTO aws.lightsail.relational_databases (
relationalDatabaseName,
availabilityZone,
relationalDatabaseBlueprintId,
relationalDatabaseBundleId,
masterDatabaseName,
masterUsername,
masterUserPassword,
preferredBackupWindow,
preferredMaintenanceWindow,
publiclyAccessible,
tags,
region
)
SELECT
'{{ relationalDatabaseName }}' /* required */,
'{{ availabilityZone }}',
'{{ relationalDatabaseBlueprintId }}' /* required */,
'{{ relationalDatabaseBundleId }}' /* required */,
'{{ masterDatabaseName }}' /* required */,
'{{ masterUsername }}' /* required */,
'{{ masterUserPassword }}',
'{{ preferredBackupWindow }}',
'{{ preferredMaintenanceWindow }}',
{{ publiclyAccessible }},
'{{ tags }}',
'{{ region }}'
RETURNING
operations
;

UPDATE examples

Allows the update of one or more attributes of a database in Amazon Lightsail. Updates are applied immediately, or in cases where the updates could result in an outage, are applied during the database's predefined maintenance window. The update relational database operation supports tag-based access control via resource tags applied to the resource identified by relationalDatabaseName. For more information, see the Amazon Lightsail Developer Guide.

UPDATE aws.lightsail.relational_databases
SET
relationalDatabaseName = '{{ relationalDatabaseName }}',
masterUserPassword = '{{ masterUserPassword }}',
rotateMasterUserPassword = {{ rotateMasterUserPassword }},
preferredBackupWindow = '{{ preferredBackupWindow }}',
preferredMaintenanceWindow = '{{ preferredMaintenanceWindow }}',
enableBackupRetention = {{ enableBackupRetention }},
disableBackupRetention = {{ disableBackupRetention }},
publiclyAccessible = {{ publiclyAccessible }},
applyImmediately = {{ applyImmediately }},
caCertificateIdentifier = '{{ caCertificateIdentifier }}',
relationalDatabaseBlueprintId = '{{ relationalDatabaseBlueprintId }}'
WHERE
region = '{{ region }}' --required
AND relationalDatabaseName = '{{ relationalDatabaseName }}' --required
RETURNING
operations;

DELETE examples

Deletes a database in Amazon Lightsail. The delete relational database operation supports tag-based access control via resource tags applied to the resource identified by relationalDatabaseName. For more information, see the Amazon Lightsail Developer Guide.

DELETE FROM aws.lightsail.relational_databases
WHERE region = '{{ region }}' --required
;

Lifecycle Methods

Restarts a specific database in Amazon Lightsail. The reboot relational database operation supports tag-based access control via resource tags applied to the resource identified by relationalDatabaseName. For more information, see the Amazon Lightsail Developer Guide.

EXEC aws.lightsail.relational_databases.reboot_relational_database
@region='{{ region }}' --required
@@json=
'{
"relationalDatabaseName": "{{ relationalDatabaseName }}"
}'
;