GlobalCluster

class GlobalCluster : KotlinCustomResource

Manages an RDS Global Cluster, which is an Aurora global database spread across multiple regions. The global database contains a single primary cluster with read-write capability, and a read-only secondary cluster that receives data from the primary cluster through high-speed replication performed by the Aurora storage subsystem. More information about Aurora global databases can be found in the Aurora User Guide.

Example Usage

New MySQL Global Cluster

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.rds.GlobalCluster;
import com.pulumi.aws.rds.GlobalClusterArgs;
import com.pulumi.aws.rds.Cluster;
import com.pulumi.aws.rds.ClusterArgs;
import com.pulumi.aws.rds.ClusterInstance;
import com.pulumi.aws.rds.ClusterInstanceArgs;
import com.pulumi.resources.CustomResourceOptions;
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 example = new GlobalCluster("example", GlobalClusterArgs.builder()
.globalClusterIdentifier("global-test")
.engine("aurora")
.engineVersion("5.6.mysql_aurora.1.22.2")
.databaseName("example_db")
.build());
var primaryCluster = new Cluster("primaryCluster", ClusterArgs.builder()
.engine(example.engine())
.engineVersion(example.engineVersion())
.clusterIdentifier("test-primary-cluster")
.masterUsername("username")
.masterPassword("somepass123")
.databaseName("example_db")
.globalClusterIdentifier(example.id())
.dbSubnetGroupName("default")
.build(), CustomResourceOptions.builder()
.provider(aws.primary())
.build());
var primaryClusterInstance = new ClusterInstance("primaryClusterInstance", ClusterInstanceArgs.builder()
.engine(example.engine())
.engineVersion(example.engineVersion())
.identifier("test-primary-cluster-instance")
.clusterIdentifier(primaryCluster.id())
.instanceClass("db.r4.large")
.dbSubnetGroupName("default")
.build(), CustomResourceOptions.builder()
.provider(aws.primary())
.build());
var secondaryCluster = new Cluster("secondaryCluster", ClusterArgs.builder()
.engine(example.engine())
.engineVersion(example.engineVersion())
.clusterIdentifier("test-secondary-cluster")
.globalClusterIdentifier(example.id())
.dbSubnetGroupName("default")
.build(), CustomResourceOptions.builder()
.provider(aws.secondary())
.dependsOn(primaryClusterInstance)
.build());
var secondaryClusterInstance = new ClusterInstance("secondaryClusterInstance", ClusterInstanceArgs.builder()
.engine(example.engine())
.engineVersion(example.engineVersion())
.identifier("test-secondary-cluster-instance")
.clusterIdentifier(secondaryCluster.id())
.instanceClass("db.r4.large")
.dbSubnetGroupName("default")
.build(), CustomResourceOptions.builder()
.provider(aws.secondary())
.build());
}
}

New PostgreSQL Global Cluster

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.Provider;
import com.pulumi.aws.ProviderArgs;
import com.pulumi.aws.rds.GlobalCluster;
import com.pulumi.aws.rds.GlobalClusterArgs;
import com.pulumi.aws.rds.Cluster;
import com.pulumi.aws.rds.ClusterArgs;
import com.pulumi.aws.rds.ClusterInstance;
import com.pulumi.aws.rds.ClusterInstanceArgs;
import com.pulumi.resources.CustomResourceOptions;
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 primary = new Provider("primary", ProviderArgs.builder()
.region("us-east-2")
.build());
var secondary = new Provider("secondary", ProviderArgs.builder()
.region("us-east-1")
.build());
var example = new GlobalCluster("example", GlobalClusterArgs.builder()
.globalClusterIdentifier("global-test")
.engine("aurora-postgresql")
.engineVersion("11.9")
.databaseName("example_db")
.build());
var primaryCluster = new Cluster("primaryCluster", ClusterArgs.builder()
.engine(example.engine())
.engineVersion(example.engineVersion())
.clusterIdentifier("test-primary-cluster")
.masterUsername("username")
.masterPassword("somepass123")
.databaseName("example_db")
.globalClusterIdentifier(example.id())
.dbSubnetGroupName("default")
.build(), CustomResourceOptions.builder()
.provider(aws.primary())
.build());
var primaryClusterInstance = new ClusterInstance("primaryClusterInstance", ClusterInstanceArgs.builder()
.engine(example.engine())
.engineVersion(example.engineVersion())
.identifier("test-primary-cluster-instance")
.clusterIdentifier(primaryCluster.id())
.instanceClass("db.r4.large")
.dbSubnetGroupName("default")
.build(), CustomResourceOptions.builder()
.provider(aws.primary())
.build());
var secondaryCluster = new Cluster("secondaryCluster", ClusterArgs.builder()
.engine(example.engine())
.engineVersion(example.engineVersion())
.clusterIdentifier("test-secondary-cluster")
.globalClusterIdentifier(example.id())
.skipFinalSnapshot(true)
.dbSubnetGroupName("default")
.build(), CustomResourceOptions.builder()
.provider(aws.secondary())
.dependsOn(primaryClusterInstance)
.build());
var secondaryClusterInstance = new ClusterInstance("secondaryClusterInstance", ClusterInstanceArgs.builder()
.engine(example.engine())
.engineVersion(example.engineVersion())
.identifier("test-secondary-cluster-instance")
.clusterIdentifier(secondaryCluster.id())
.instanceClass("db.r4.large")
.dbSubnetGroupName("default")
.build(), CustomResourceOptions.builder()
.provider(aws.secondary())
.build());
}
}

New Global Cluster From Existing DB Cluster

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.rds.Cluster;
import com.pulumi.aws.rds.GlobalCluster;
import com.pulumi.aws.rds.GlobalClusterArgs;
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 exampleCluster = new Cluster("exampleCluster");
var exampleGlobalCluster = new GlobalCluster("exampleGlobalCluster", GlobalClusterArgs.builder()
.forceDestroy(true)
.globalClusterIdentifier("example")
.sourceDbClusterIdentifier(exampleCluster.arn())
.build());
}
}

Upgrading Engine Versions

When you upgrade the version of an aws.rds.GlobalCluster, the provider will attempt to in-place upgrade the engine versions of all associated clusters. Since the aws.rds.Cluster resource is being updated through the aws.rds.GlobalCluster, you are likely to get an error (Provider produced inconsistent final plan). To avoid this, use the lifecycle ignore_changes meta argument as shown below on the aws.rds.Cluster.

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.rds.GlobalCluster;
import com.pulumi.aws.rds.GlobalClusterArgs;
import com.pulumi.aws.rds.Cluster;
import com.pulumi.aws.rds.ClusterArgs;
import com.pulumi.aws.rds.ClusterInstance;
import com.pulumi.aws.rds.ClusterInstanceArgs;
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 example = new GlobalCluster("example", GlobalClusterArgs.builder()
.globalClusterIdentifier("kyivkharkiv")
.engine("aurora-mysql")
.engineVersion("5.7.mysql_aurora.2.07.5")
.build());
var primaryCluster = new Cluster("primaryCluster", ClusterArgs.builder()
.allowMajorVersionUpgrade(true)
.applyImmediately(true)
.clusterIdentifier("odessadnipro")
.databaseName("totoro")
.engine(example.engine())
.engineVersion(example.engineVersion())
.globalClusterIdentifier(example.id())
.masterPassword("satsukimae")
.masterUsername("maesatsuki")
.skipFinalSnapshot(true)
.build());
var primaryClusterInstance = new ClusterInstance("primaryClusterInstance", ClusterInstanceArgs.builder()
.applyImmediately(true)
.clusterIdentifier(primaryCluster.id())
.engine(primaryCluster.engine())
.engineVersion(primaryCluster.engineVersion())
.identifier("donetsklviv")
.instanceClass("db.r4.large")
.build());
}
}

Import

aws_rds_global_cluster can be imported by using the RDS Global Cluster identifier, e.g.,

$ pulumi import aws:rds/globalCluster:GlobalCluster example example

Certain resource arguments, like force_destroy, only exist within this provider. If the argument is set in the the provider configuration on an imported resource, This provider will show a difference on the first plan after import to update the state value. This change is safe to apply immediately so the state matches the desired configuration. Certain resource arguments, like source_db_cluster_identifier, do not have an API method for reading the information after creation. If the argument is set in the provider configuration on an imported resource, the provider will always show a difference. To workaround this behavior, either omit the argument from the the provider configuration or use ignore_changes to hide the difference, e.g. terraform resource "aws_rds_global_cluster" "example" {

... other configuration ...

There is no API for reading source_db_cluster_identifier

lifecycle { ignore_changes = source_db_cluster_identifier } }

Properties

Link copied to clipboard
val arn: Output<String>

RDS Global Cluster Amazon Resource Name (ARN)

Link copied to clipboard
val databaseName: Output<String>?

Name for an automatically created database on cluster creation.

Link copied to clipboard

If the Global Cluster should have deletion protection enabled. The database can't be deleted when this value is set to true. The default is false.

Link copied to clipboard
val engine: Output<String>

Name of the database engine to be used for this DB cluster. The provider will only perform drift detection if a configuration value is provided. Valid values: aurora, aurora-mysql, aurora-postgresql. Defaults to aurora. Conflicts with source_db_cluster_identifier.

Link copied to clipboard
val engineVersion: Output<String>

Engine version of the Aurora global database. The engine, engine_version, and instance_class (on the aws.rds.ClusterInstance) must together support global databases. See Using Amazon Aurora global databases for more information. By upgrading the engine version, the provider will upgrade cluster members. NOTE: To avoid an inconsistent final plan error while upgrading, use the lifecycle ignore_changes for engine_version meta argument on the associated aws.rds.Cluster resource as shown above in Upgrading Engine Versions example.

Link copied to clipboard
Link copied to clipboard
val forceDestroy: Output<Boolean>?

Enable to remove DB Cluster members from Global Cluster on destroy. Required with source_db_cluster_identifier.

Link copied to clipboard

Global cluster identifier.

Link copied to clipboard

Set of objects containing Global Cluster members.

Link copied to clipboard

AWS Region-unique, immutable identifier for the global database cluster. This identifier is found in AWS CloudTrail log entries whenever the AWS KMS key for the DB cluster is accessed

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Amazon Resource Name (ARN) to use as the primary DB Cluster of the Global Cluster on creation. The provider cannot perform drift detection of this value.

Link copied to clipboard

Specifies whether the DB cluster is encrypted. The default is false unless source_db_cluster_identifier is specified and encrypted. The provider will only perform drift detection if a configuration value is provided.

Link copied to clipboard
val urn: Output<String>