databases
Creates, updates, deletes or gets a database
resource or lists databases
in a region
Overview
Name | databases |
Type | Resource |
Description | Resource Type definition for AWS::Lightsail::Database |
Id | aws.lightsail.databases |
Fields
Name | Datatype | Description |
---|---|---|
relational_database_name | string | The name to use for your new Lightsail database resource. |
database_arn | string | |
availability_zone | string | The Availability Zone in which to create your new database. Use the us-east-2a case-sensitive format. |
relational_database_blueprint_id | string | The blueprint ID for your new database. A blueprint describes the major engine version of a database. |
relational_database_bundle_id | string | The bundle ID for your new database. A bundle describes the performance specifications for your database. |
master_database_name | string | The name of the database to create when the Lightsail database resource is created. For MySQL, if this parameter isn't specified, no database is created in the database resource. For PostgreSQL, if this parameter isn't specified, a database named postgres is created in the database resource. |
master_username | string | The name for the master user. |
master_user_password | string | The password for the master user. The password can include any printable ASCII character except "/", """, or "@". It cannot contain spaces. |
preferred_backup_window | string | The daily time range during which automated backups are created for your new database if automated backups are enabled. |
preferred_maintenance_window | string | The weekly time range during which system maintenance can occur on your new database. |
publicly_accessible | boolean | Specifies the accessibility options for your new database. A value of true specifies a database that is available to resources outside of your Lightsail account. A value of false specifies a database that is available only to your Lightsail resources in the same region as your database. |
ca_certificate_identifier | string | Indicates the certificate that needs to be associated with the database. |
backup_retention | boolean | When true, enables automated backup retention for your database. Updates are applied during the next maintenance window because this can result in an outage. |
rotate_master_user_password | boolean | When true, the master user password is changed to a new strong password generated by Lightsail. Use the get relational database master user password operation to get the new password. |
relational_database_parameters | array | Update one or more parameters of the relational database. |
tags | array | An array of key-value pairs to apply to this resource. |
region | string | AWS region. |
Methods
Name | Accessible by | Required Params |
---|---|---|
create_resource | INSERT | RelationalDatabaseName, RelationalDatabaseBlueprintId, RelationalDatabaseBundleId, MasterDatabaseName, MasterUsername, region |
delete_resource | DELETE | data__Identifier, region |
update_resource | UPDATE | data__Identifier, data__PatchDocument, region |
list_resources | SELECT | region |
get_resource | SELECT | data__Identifier, region |
SELECT
examples
Gets all databases
in a region.
SELECT
region,
relational_database_name,
database_arn,
availability_zone,
relational_database_blueprint_id,
relational_database_bundle_id,
master_database_name,
master_username,
master_user_password,
preferred_backup_window,
preferred_maintenance_window,
publicly_accessible,
ca_certificate_identifier,
backup_retention,
rotate_master_user_password,
relational_database_parameters,
tags
FROM aws.lightsail.databases
WHERE region = 'us-east-1';
Gets all properties from an individual database
.
SELECT
region,
relational_database_name,
database_arn,
availability_zone,
relational_database_blueprint_id,
relational_database_bundle_id,
master_database_name,
master_username,
master_user_password,
preferred_backup_window,
preferred_maintenance_window,
publicly_accessible,
ca_certificate_identifier,
backup_retention,
rotate_master_user_password,
relational_database_parameters,
tags
FROM aws.lightsail.databases
WHERE region = 'us-east-1' AND data__Identifier = '<RelationalDatabaseName>';
INSERT
example
Use the following StackQL query and manifest file to create a new database
resource, using stack-deploy
.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO aws.lightsail.databases (
RelationalDatabaseName,
RelationalDatabaseBlueprintId,
RelationalDatabaseBundleId,
MasterDatabaseName,
MasterUsername,
region
)
SELECT
'{{ RelationalDatabaseName }}',
'{{ RelationalDatabaseBlueprintId }}',
'{{ RelationalDatabaseBundleId }}',
'{{ MasterDatabaseName }}',
'{{ MasterUsername }}',
'{{ region }}';
/*+ create */
INSERT INTO aws.lightsail.databases (
RelationalDatabaseName,
AvailabilityZone,
RelationalDatabaseBlueprintId,
RelationalDatabaseBundleId,
MasterDatabaseName,
MasterUsername,
MasterUserPassword,
PreferredBackupWindow,
PreferredMaintenanceWindow,
PubliclyAccessible,
CaCertificateIdentifier,
BackupRetention,
RotateMasterUserPassword,
RelationalDatabaseParameters,
Tags,
region
)
SELECT
'{{ RelationalDatabaseName }}',
'{{ AvailabilityZone }}',
'{{ RelationalDatabaseBlueprintId }}',
'{{ RelationalDatabaseBundleId }}',
'{{ MasterDatabaseName }}',
'{{ MasterUsername }}',
'{{ MasterUserPassword }}',
'{{ PreferredBackupWindow }}',
'{{ PreferredMaintenanceWindow }}',
'{{ PubliclyAccessible }}',
'{{ CaCertificateIdentifier }}',
'{{ BackupRetention }}',
'{{ RotateMasterUserPassword }}',
'{{ RelationalDatabaseParameters }}',
'{{ Tags }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: database
props:
- name: RelationalDatabaseName
value: '{{ RelationalDatabaseName }}'
- name: AvailabilityZone
value: '{{ AvailabilityZone }}'
- name: RelationalDatabaseBlueprintId
value: '{{ RelationalDatabaseBlueprintId }}'
- name: RelationalDatabaseBundleId
value: '{{ RelationalDatabaseBundleId }}'
- name: MasterDatabaseName
value: '{{ MasterDatabaseName }}'
- name: MasterUsername
value: '{{ MasterUsername }}'
- name: MasterUserPassword
value: '{{ MasterUserPassword }}'
- name: PreferredBackupWindow
value: '{{ PreferredBackupWindow }}'
- name: PreferredMaintenanceWindow
value: '{{ PreferredMaintenanceWindow }}'
- name: PubliclyAccessible
value: '{{ PubliclyAccessible }}'
- name: CaCertificateIdentifier
value: '{{ CaCertificateIdentifier }}'
- name: BackupRetention
value: '{{ BackupRetention }}'
- name: RotateMasterUserPassword
value: '{{ RotateMasterUserPassword }}'
- name: RelationalDatabaseParameters
value:
- AllowedValues: '{{ AllowedValues }}'
ApplyMethod: '{{ ApplyMethod }}'
ApplyType: '{{ ApplyType }}'
DataType: '{{ DataType }}'
Description: '{{ Description }}'
IsModifiable: '{{ IsModifiable }}'
ParameterName: '{{ ParameterName }}'
ParameterValue: '{{ ParameterValue }}'
- name: Tags
value:
- Key: '{{ Key }}'
Value: '{{ Value }}'
DELETE
example
/*+ delete */
DELETE FROM aws.lightsail.databases
WHERE data__Identifier = '<RelationalDatabaseName>'
AND region = 'us-east-1';
Permissions
To operate on the databases
resource, the following permissions are required:
Create
lightsail:CreateRelationalDatabase,
lightsail:GetRelationalDatabase,
lightsail:GetRelationalDatabases,
lightsail:GetRegions,
lightsail:TagResource,
lightsail:UntagResource,
lightsail:UpdateRelationalDatabase,
lightsail:UpdateRelationalDatabaseParameters
Read
lightsail:GetRelationalDatabase,
lightsail:GetRelationalDatabases
Update
lightsail:GetRelationalDatabase,
lightsail:GetRelationalDatabases,
lightsail:TagResource,
lightsail:UntagResource,
lightsail:UpdateRelationalDatabase,
lightsail:UpdateRelationalDatabaseParameters
Delete
lightsail:DeleteRelationalDatabase,
lightsail:GetRelationalDatabase,
lightsail:GetRelationalDatabases
List
lightsail:GetRelationalDatabases