DatabaseArgs

data class DatabaseArgs(val applyImmediately: Output<Boolean>? = null, val availabilityZone: Output<String>? = null, val backupRetentionEnabled: Output<Boolean>? = null, val blueprintId: Output<String>? = null, val bundleId: Output<String>? = null, val finalSnapshotName: Output<String>? = null, val masterDatabaseName: Output<String>? = null, val masterPassword: Output<String>? = null, val masterUsername: Output<String>? = null, val preferredBackupWindow: Output<String>? = null, val preferredMaintenanceWindow: Output<String>? = null, val publiclyAccessible: Output<Boolean>? = null, val relationalDatabaseName: Output<String>? = null, val skipFinalSnapshot: Output<Boolean>? = null, val tags: Output<Map<String, String>>? = null) : ConvertibleToJava<DatabaseArgs>

Provides a Lightsail Database. Amazon Lightsail is a service to provide easy virtual private servers with custom software already setup. See What is Amazon Lightsail? for more information.

Note: Lightsail is currently only supported in a limited number of AWS Regions, please see "Regions and Availability Zones" for more details

Example Usage

Basic mysql blueprint

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.lightsail.Database;
import com.pulumi.aws.lightsail.DatabaseArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var test = new Database("test", DatabaseArgs.builder()
.availabilityZone("us-east-1a")
.blueprintId("mysql_8_0")
.bundleId("micro_1_0")
.masterDatabaseName("testdatabasename")
.masterPassword("testdatabasepassword")
.masterUsername("test")
.name("test")
.build());
}
}

Basic postrgres blueprint

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.lightsail.Database;
import com.pulumi.aws.lightsail.DatabaseArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var test = new Database("test", DatabaseArgs.builder()
.availabilityZone("us-east-1a")
.blueprintId("postgres_12")
.bundleId("micro_1_0")
.masterDatabaseName("testdatabasename")
.masterPassword("testdatabasepassword")
.masterUsername("test")
.name("test")
.build());
}
}

Custom backup and maintenance windows

Below is an example that sets a custom backup and maintenance window. Times are specified in UTC. This example will allow daily backups to take place between 16:00 and 16:30 each day. This example also requires any maintiance tasks (anything that would cause an outage, including changing some attributes) to take place on Tuesdays between 17:00 and 17:30. An action taken against this database that would cause an outage will wait until this time window to make the requested changes.

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.lightsail.Database;
import com.pulumi.aws.lightsail.DatabaseArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var test = new Database("test", DatabaseArgs.builder()
.availabilityZone("us-east-1a")
.blueprintId("postgres_12")
.bundleId("micro_1_0")
.masterDatabaseName("testdatabasename")
.masterPassword("testdatabasepassword")
.masterUsername("test")
.name("test")
.preferredBackupWindow("16:00-16:30")
.preferredMaintenanceWindow("Tue:17:00-Tue:17:30")
.build());
}
}

Final Snapshots

To enable creating a final snapshot of your database on deletion, use the final_snapshot_name argument to provide a name to be used for the snapshot.

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.lightsail.Database;
import com.pulumi.aws.lightsail.DatabaseArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var test = new Database("test", DatabaseArgs.builder()
.availabilityZone("us-east-1a")
.blueprintId("postgres_12")
.bundleId("micro_1_0")
.finalSnapshotName("MyFinalSnapshot")
.masterDatabaseName("testdatabasename")
.masterPassword("testdatabasepassword")
.masterUsername("test")
.name("test")
.preferredBackupWindow("16:00-16:30")
.preferredMaintenanceWindow("Tue:17:00-Tue:17:30")
.build());
}
}

Apply Immediately

To enable applying changes immediately instead of waiting for a maintiance window, use the apply_immediately argument.

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.lightsail.Database;
import com.pulumi.aws.lightsail.DatabaseArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var test = new Database("test", DatabaseArgs.builder()
.applyImmediately(true)
.availabilityZone("us-east-1a")
.blueprintId("postgres_12")
.bundleId("micro_1_0")
.masterDatabaseName("testdatabasename")
.masterPassword("testdatabasepassword")
.masterUsername("test")
.name("test")
.build());
}
}

Blueprint Ids

A list of all available Lightsail Blueprints for Relational Databases the aws lightsail get-relational-database-blueprints aws cli command.

Examples

  • mysql_8_0

  • postgres_12

Prefix

A Blueprint ID starts with a prefix of the engine type.

Suffix

A Blueprint ID has a sufix of the engine version.

Bundles

A list of all available Lightsail Bundles for Relational Databases the aws lightsail get-relational-database-bundles aws cli command.

Examples

  • small_1_0

  • small_ha_1_0

  • large_1_0

  • large_ha_1_0

Prefix

A Bundle ID starts with one of the below size prefixes:

  • micro_

  • small_

  • medium_

  • large_

Infixes (Optional for HA Database)

A Bundle Id can have the following infix added in order to use the HA option of the selected bundle.

  • ha_

Suffix

A Bundle ID ends with one of the following suffix: 1_0

Import

Lightsail Databases can be imported using their name, e.g.

$ pulumi import aws:lightsail/database:Database foo 'bar'

Constructors

Link copied to clipboard
constructor(applyImmediately: Output<Boolean>? = null, availabilityZone: Output<String>? = null, backupRetentionEnabled: Output<Boolean>? = null, blueprintId: Output<String>? = null, bundleId: Output<String>? = null, finalSnapshotName: Output<String>? = null, masterDatabaseName: Output<String>? = null, masterPassword: Output<String>? = null, masterUsername: Output<String>? = null, preferredBackupWindow: Output<String>? = null, preferredMaintenanceWindow: Output<String>? = null, publiclyAccessible: Output<Boolean>? = null, relationalDatabaseName: Output<String>? = null, skipFinalSnapshot: Output<Boolean>? = null, tags: Output<Map<String, String>>? = null)

Properties

Link copied to clipboard
val applyImmediately: Output<Boolean>? = null

When true , applies changes immediately. When false , applies changes during the preferred maintenance window. Some changes may cause an outage.

Link copied to clipboard
val availabilityZone: Output<String>? = null

The Availability Zone in which to create your new database. Use the us-east-2a case-sensitive format.

Link copied to clipboard
val backupRetentionEnabled: Output<Boolean>? = null

When true, enables automated backup retention for your database. When false, disables automated backup retention for your database. Disabling backup retention deletes all automated database backups. Before disabling this, you may want to create a snapshot of your database.

Link copied to clipboard
val blueprintId: Output<String>? = null

The blueprint ID for your new database. A blueprint describes the major engine version of a database. You can get a list of database blueprints IDs by using the AWS CLI command: aws lightsail get-relational-database-blueprints

Link copied to clipboard
val bundleId: Output<String>? = null

The bundle ID for your new database. A bundle describes the performance specifications for your database (see list below). You can get a list of database bundle IDs by using the AWS CLI command: aws lightsail get-relational-database-bundles.

Link copied to clipboard
val finalSnapshotName: Output<String>? = null

The name of the database snapshot created if skip final snapshot is false, which is the default value for that parameter.

Link copied to clipboard
val masterDatabaseName: Output<String>? = null

The name of the master database created when the Lightsail database resource is created.

Link copied to clipboard
val masterPassword: Output<String>? = null

The password for the master user of your new database. The password can include any printable ASCII character except "/", """, or "@".

Link copied to clipboard
val masterUsername: Output<String>? = null

The master user name for your new database.

Link copied to clipboard
val preferredBackupWindow: Output<String>? = null

The daily time range during which automated backups are created for your new database if automated backups are enabled. Must be in the hh24:mi-hh24:mi format. Example: 16:00-16:30. Specified in Coordinated Universal Time (UTC).

Link copied to clipboard
val preferredMaintenanceWindow: Output<String>? = null

The weekly time range during which system maintenance can occur on your new database. Must be in the ddd:hh24:mi-ddd:hh24:mi format. Specified in Coordinated Universal Time (UTC). Example: Tue:17:00-Tue:17:30

Link copied to clipboard
val publiclyAccessible: Output<Boolean>? = null

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.

Link copied to clipboard
val relationalDatabaseName: Output<String>? = null
Link copied to clipboard
val skipFinalSnapshot: Output<Boolean>? = null

Determines whether a final database snapshot is created before your database is deleted. If true is specified, no database snapshot is created. If false is specified, a database snapshot is created before your database is deleted. You must specify the final relational database snapshot name parameter if the skip final snapshot parameter is false.

Link copied to clipboard
val tags: Output<Map<String, String>>? = null

A map of tags to assign to the resource. To create a key-only tag, use an empty string as the value.

Functions

Link copied to clipboard
open override fun toJava(): DatabaseArgs