ClusterInstance class
Provides an RDS Cluster Instance Resource. A Cluster Instance Resource defines attributes that are specific to a single instance in a RDS Cluster, specifically running Amazon Aurora.
Unlike other RDS resources that support replication, with Amazon Aurora you do
not designate a primary and subsequent replicas. Instead, you simply add RDS
Instances and Aurora manages the replication. You can use the count
meta-parameter to make multiple instances and join them all to the same RDS
Cluster, or you may specify different Cluster Instance resources with various
instanceClass sizes.
For more information on Amazon Aurora, see Aurora on Amazon RDS in the Amazon RDS User Guide.
> NOTE: Deletion Protection from the RDS service can only be enabled at the cluster level, not for individual cluster instances. You can still add the protect CustomResourceOption to this resource configuration if you desire protection from accidental deletion.
> NOTE: aurora is no longer a valid engine because of Amazon Aurora's MySQL-Compatible Edition version 1 end of life.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const _default = new aws.rds.Cluster("default", {
clusterIdentifier: "aurora-cluster-demo",
availabilityZones: [
"us-west-2a",
"us-west-2b",
"us-west-2c",
],
databaseName: "mydb",
masterUsername: "foo",
masterPassword: "barbut8chars",
});
const clusterInstances: aws.rds.ClusterInstance[] = [];
for (let range = 0; range < 2; range++) {
clusterInstances.push(new aws.rds.ClusterInstance(`cluster_instances-${range}`, {
identifier: `aurora-cluster-demo-${range}`,
clusterIdentifier: _default.id,
instanceClass: aws.rds.InstanceType.R4_Large,
engine: _default.engine.apply((x) => aws.rds.EngineType[x]),
engineVersion: _default.engineVersion,
}));
}
import pulumi
from typing import Any
import pulumi_aws as aws
default = aws.rds.Cluster("default",
cluster_identifier="aurora-cluster-demo",
availability_zones=[
"us-west-2a",
"us-west-2b",
"us-west-2c",
],
database_name="mydb",
master_username="foo",
master_password="barbut8chars")
cluster_instances: list[aws.rds.ClusterInstance] = []
for cluster_instances_range in [{"value": i} for i in range(0, 2)]:
cluster_instances.append(aws.rds.ClusterInstance(f"cluster_instances-{cluster_instances_range['value']}",
identifier=f"aurora-cluster-demo-{cluster_instances_range['value']}",
cluster_identifier=default.id,
instance_class=aws.rds.InstanceType.R4_LARGE,
engine=default.engine.apply(lambda x: aws.rds.EngineType(x)),
engine_version=default.engine_version))
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var @default = new Aws.Rds.Cluster("default", new()
{
ClusterIdentifier = "aurora-cluster-demo",
AvailabilityZones = new[]
{
"us-west-2a",
"us-west-2b",
"us-west-2c",
},
DatabaseName = "mydb",
MasterUsername = "foo",
MasterPassword = "barbut8chars",
});
var clusterInstances = new List<Aws.Rds.ClusterInstance>();
for (var rangeIndex = 0; rangeIndex < 2; rangeIndex++)
{
var range = new { Value = rangeIndex };
clusterInstances.Add(new Aws.Rds.ClusterInstance($"cluster_instances-{range.Value}", new()
{
Identifier = $"aurora-cluster-demo-{range.Value}",
ClusterIdentifier = @default.Id,
InstanceClass = Aws.Rds.InstanceType.R4_Large,
Engine = @default.Engine.Apply(System.Enum.Parse<Aws.Rds.EngineType>),
EngineVersion = @default.EngineVersion,
}));
}
});
package main
import (
"fmt"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/rds"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_default, err := rds.NewCluster(ctx, "default", &rds.ClusterArgs{
ClusterIdentifier: pulumi.String("aurora-cluster-demo"),
AvailabilityZones: pulumi.StringArray{
pulumi.String("us-west-2a"),
pulumi.String("us-west-2b"),
pulumi.String("us-west-2c"),
},
DatabaseName: pulumi.String("mydb"),
MasterUsername: pulumi.String("foo"),
MasterPassword: pulumi.String("barbut8chars"),
})
if err != nil {
return err
}
var clusterInstances []*rds.ClusterInstance
for index := 0; index < 2; index++ {
key0 := index
val0 := index
__res, err := rds.NewClusterInstance(ctx, fmt.Sprintf("cluster_instances-%v", key0), &rds.ClusterInstanceArgs{
Identifier: pulumi.Sprintf("aurora-cluster-demo-%v", val0),
ClusterIdentifier: _default.ID().ToIDOutput().ToStringOutput(),
InstanceClass: pulumi.String(rds.InstanceType_R4_Large),
Engine: _default.Engine.ApplyT(func(x *string) rds.EngineType { return rds.EngineType(*x) }).(rds.EngineTypeOutput),
EngineVersion: _default.EngineVersion,
})
if err != nil {
return err
}
clusterInstances = append(clusterInstances, __res)
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_rds_clusterinstance" "cluster_instances" {
count = 2
identifier ="aurora-cluster-demo-${count.index}"
cluster_identifier = aws_rds_cluster.default.id
instance_class = "db.r4.large"
engine = aws_rds_cluster.default.engine
engine_version = aws_rds_cluster.default.engine_version
}
resource "aws_rds_cluster" "default" {
cluster_identifier = "aurora-cluster-demo"
availability_zones = ["us-west-2a", "us-west-2b", "us-west-2c"]
database_name = "mydb"
master_username = "foo"
master_password = "barbut8chars"
}
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.ClusterArgs;
import com.pulumi.aws.rds.ClusterInstance;
import com.pulumi.aws.rds.ClusterInstanceArgs;
import com.pulumi.codegen.internal.KeyedValue;
import java.util.ArrayList;
import java.util.Arrays;
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 default_ = new Cluster("default", ClusterArgs.builder()
.clusterIdentifier("aurora-cluster-demo")
.availabilityZones(
"us-west-2a",
"us-west-2b",
"us-west-2c")
.databaseName("mydb")
.masterUsername("foo")
.masterPassword("barbut8chars")
.build());
for (var i = 0; i < 2; i++) {
new ClusterInstance("clusterInstances-" + i, ClusterInstanceArgs.builder()
.identifier(String.format("aurora-cluster-demo-%s", range.value()))
.clusterIdentifier(default_.id())
.instanceClass("db.r4.large")
.engine(default_.engine())
.engineVersion(default_.engineVersion())
.build());
}
}
}
resources:
clusterInstances:
type: aws:rds:ClusterInstance
name: cluster_instances
properties:
identifier: aurora-cluster-demo-${range.value}
clusterIdentifier: ${default.id}
instanceClass: db.r4.large
engine: ${default.engine}
engineVersion: ${default.engineVersion}
options: {}
default:
type: aws:rds:Cluster
properties:
clusterIdentifier: aurora-cluster-demo
availabilityZones:
- us-west-2a
- us-west-2b
- us-west-2c
databaseName: mydb
masterUsername: foo
masterPassword: barbut8chars
Import
Using pulumi import, import RDS Cluster Instances using the identifier. For example:
$ pulumi import aws:rds/clusterInstance:ClusterInstance prod_instance_1 aurora-cluster-instance-1
Constructors
- ClusterInstance(String name, {ClusterInstanceArgs? args, CustomResourceOptions? options})
-
Creates a new ClusterInstance.
nameThe Pulumi resource name.argsArguments used to configure this ClusterInstance. The set of arguments for ClusterInstance.optionsResource options controlling this resource's behavior. - ClusterInstance.reference(String urn)
- Creates a typed reference to an existing ClusterInstance resource.
Properties
-
applyImmediately
↔ Output<
bool> -
Specifies whether any database modifications are applied immediately, or during the next maintenance window. Default is
false.latefinal -
arn
↔ Output<
String> -
ARN of cluster instance
latefinal
-
autoMinorVersionUpgrade
↔ Output<
bool?> -
Indicates that minor engine upgrades will be applied automatically to the DB instance during the maintenance window. Default
true.latefinal -
availabilityZone
↔ Output<
String> -
EC2 Availability Zone that the DB instance is created in. See docs about the details.
latefinal
-
caCertIdentifier
↔ Output<
String> -
Identifier of the CA certificate for the DB instance.
latefinal
-
childResources
→ Set<
Resource> -
finalinherited
-
clusterIdentifier
↔ Output<
String> -
Identifier of the
aws.rds.Clusterin which to launch this instance.latefinal -
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
copyTagsToSnapshot
↔ Output<
bool?> -
Indicates whether to copy all of the user-defined tags from the DB instance to snapshots of the DB instance. Default
false.latefinal -
customIamInstanceProfile
↔ Output<
String?> -
Instance profile associated with the underlying Amazon EC2 instance of an RDS Custom DB instance.
latefinal
-
dbiResourceId
↔ Output<
String> -
Region-unique, immutable identifier for the DB instance.
latefinal
-
dbParameterGroupName
↔ Output<
String> -
Name of the DB parameter group to associate with this instance.
latefinal
-
dbSubnetGroupName
↔ Output<
String> -
Specifies the DB subnet group to associate with this DB instance. The default behavior varies depending on whether
dbSubnetGroupNameis specified. Please refer to official AWS documentation to understand howdbSubnetGroupNameandpubliclyAccessibleparameters affect DB instance behaviour. NOTE: This must match thedbSubnetGroupNameof the attachedaws.rds.Cluster.latefinal -
endpoint
↔ Output<
String> -
DNS address for this instance. May not be writable
latefinal
-
engine
↔ Output<
EngineType> -
Name of the database engine to be used for the RDS cluster instance.
Valid Values:
aurora-mysql,aurora-postgresql,mysql,postgres.(Note thatmysqlandpostgresare Multi-AZ RDS clusters).latefinal -
engineVersion
↔ Output<
String> -
Database engine version. Please note that to upgrade the
engineVersionof the instance, it must be done on theaws.rds.ClusterengineVersion. Trying to upgrade inaws.rds.ClusterInstancewill not update theengineVersion.latefinal -
engineVersionActual
↔ Output<
String> -
Database engine version
latefinal
-
forceDestroy
↔ Output<
bool?> -
Forces an instance to be destroyed when a part of a read replica cluster. Note: will promote the read replica to a standalone cluster before instance deletion.
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
-
id
↔ Output<
String> -
getter/setter pairinherited
-
identifier
↔ Output<
String> -
Identifier for the RDS instance, if omitted, Pulumi will assign a random, unique identifier.
latefinal
-
identifierPrefix
↔ Output<
String> -
Creates a unique identifier beginning with the specified prefix. Conflicts with
identifier.latefinal -
instanceClass
↔ Output<
String> -
Instance class to use. For details on CPU and memory, see Scaling Aurora DB Instances. Aurora uses
db.*instance classes/types. Please see AWS Documentation for currently available instance classes and complete details. For Aurora Serverless v2 usedb.serverless.latefinal - isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
kmsKeyId
↔ Output<
String> -
ARN for the KMS encryption key if one is set to the cluster.
latefinal
-
monitoringInterval
↔ Output<
int?> -
Interval, in seconds, between points when Enhanced Monitoring metrics are collected for the DB instance. To disable collecting Enhanced Monitoring metrics, specify 0. The default is 0. Valid Values: 0, 1, 5, 10, 15, 30, 60.
latefinal
-
monitoringRoleArn
↔ Output<
String> -
ARN for the IAM role that permits RDS to send enhanced monitoring metrics to CloudWatch Logs. You can find more information on the AWS Documentation what IAM permissions are needed to allow Enhanced Monitoring for RDS Instances.
latefinal
-
networkType
↔ Output<
String> -
Network type of the DB instance.
latefinal
-
performanceInsightsEnabled
↔ Output<
bool> -
Specifies whether Performance Insights is enabled or not. NOTE: When Performance Insights is configured at the cluster level through
aws.rds.Cluster, this argument cannot be set to a value that conflicts with the cluster's configuration.latefinal -
performanceInsightsKmsKeyId
↔ Output<
String> -
ARN for the KMS key to encrypt Performance Insights data. When specifying
performanceInsightsKmsKeyId,performanceInsightsEnabledneeds to be set to true.latefinal -
performanceInsightsRetentionPeriod
↔ Output<
int> -
Amount of time in days to retain Performance Insights data. Valid values are
7,731(2 years) or a multiple of31. When specifyingperformanceInsightsRetentionPeriod,performanceInsightsEnabledneeds to be set to true. Defaults to '7'.latefinal -
port
↔ Output<
int> -
Database port
latefinal
-
preferredBackupWindow
↔ Output<
String> -
Daily time range during which automated backups are created if automated backups are enabled. Eg: "04:00-09:00". NOTE: If
preferredBackupWindowis set at the cluster level, this argument must be omitted.latefinal -
preferredMaintenanceWindow
↔ Output<
String> -
Window to perform maintenance in. Syntax: "ddd:hh24:mi-ddd:hh24:mi". Eg: "Mon:00:00-Mon:03:00".
latefinal
-
promotionTier
↔ Output<
int?> -
Default 0. Failover Priority setting on instance level. The reader who has lower tier has higher priority to get promoted to writer.
latefinal
-
publiclyAccessible
↔ Output<
bool> -
Bool to control if instance is publicly accessible. Default
false. See the documentation on Creating DB Instances for more details on controlling this property.latefinal -
region
↔ Output<
String> -
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
storageEncrypted
↔ Output<
bool> -
Specifies whether the DB cluster is encrypted.
latefinal
-
Map of tags to assign to the instance. If configured with a provider
defaultTagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.latefinal -
Map of tags assigned to the resource, including those inherited from the provider
defaultTagsconfiguration block.latefinal -
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
-
writer
↔ Output<
bool> -
Boolean indicating if this instance is writable.
Falseindicates this instance is a read replica.latefinal
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
get(
String name, Input< String> id, {ClusterInstanceState? state, CustomResourceOptions? options}) → ClusterInstance -
Gets an existing ClusterInstance resource's state with the given
nameandid.