ClusterInstance class

Provides an DocumentDB Cluster Resource Instance. A Cluster Instance Resource defines attributes that are specific to a single instance in a DocumentDB Cluster.

You do not designate a primary and subsequent replicas. Instead, you simply add DocumentDB Instances and DocumentDB manages the replication. You can use the count meta-parameter to make multiple instances and join them all to the same DocumentDB Cluster, or you may specify different Cluster Instance resources with various instanceClass sizes.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const _default = new aws.docdb.Cluster("default", {
    clusterIdentifier: "docdb-cluster-demo",
    availabilityZones: [
        "us-west-2a",
        "us-west-2b",
        "us-west-2c",
    ],
    masterUsername: "foo",
    masterPassword: "barbut8chars",
});
const clusterInstances: aws.docdb.ClusterInstance[] = [];
for (let range = 0; range < 2; range++) {
    clusterInstances.push(new aws.docdb.ClusterInstance(`cluster_instances-${range}`, {
        identifier: `docdb-cluster-demo-${range}`,
        clusterIdentifier: _default.id,
        instanceClass: "db.r5.large",
    }));
}
import pulumi
from typing import Any
import pulumi_aws as aws

default = aws.docdb.Cluster("default",
    cluster_identifier="docdb-cluster-demo",
    availability_zones=[
        "us-west-2a",
        "us-west-2b",
        "us-west-2c",
    ],
    master_username="foo",
    master_password="barbut8chars")
cluster_instances: list[aws.docdb.ClusterInstance] = []
for cluster_instances_range in [{"value": i} for i in range(0, 2)]:
    cluster_instances.append(aws.docdb.ClusterInstance(f"cluster_instances-{cluster_instances_range['value']}",
        identifier=f"docdb-cluster-demo-{cluster_instances_range['value']}",
        cluster_identifier=default.id,
        instance_class="db.r5.large"))
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var @default = new Aws.DocDB.Cluster("default", new()
    {
        ClusterIdentifier = "docdb-cluster-demo",
        AvailabilityZones = new[]
        {
            "us-west-2a",
            "us-west-2b",
            "us-west-2c",
        },
        MasterUsername = "foo",
        MasterPassword = "barbut8chars",
    });

    var clusterInstances = new List<Aws.DocDB.ClusterInstance>();
    for (var rangeIndex = 0; rangeIndex < 2; rangeIndex++)
    {
        var range = new { Value = rangeIndex };
        clusterInstances.Add(new Aws.DocDB.ClusterInstance($"cluster_instances-{range.Value}", new()
        {
            Identifier = $"docdb-cluster-demo-{range.Value}",
            ClusterIdentifier = @default.Id,
            InstanceClass = "db.r5.large",
        }));
    }
});
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/docdb"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_default, err := docdb.NewCluster(ctx, "default", &docdb.ClusterArgs{
			ClusterIdentifier: pulumi.String("docdb-cluster-demo"),
			AvailabilityZones: pulumi.StringArray{
				pulumi.String("us-west-2a"),
				pulumi.String("us-west-2b"),
				pulumi.String("us-west-2c"),
			},
			MasterUsername: pulumi.String("foo"),
			MasterPassword: pulumi.String("barbut8chars"),
		})
		if err != nil {
			return err
		}
		var clusterInstances []*docdb.ClusterInstance
		for index := 0; index < 2; index++ {
			key0 := index
			val0 := index
			__res, err := docdb.NewClusterInstance(ctx, fmt.Sprintf("cluster_instances-%v", key0), &docdb.ClusterInstanceArgs{
				Identifier:        pulumi.Sprintf("docdb-cluster-demo-%v", val0),
				ClusterIdentifier: _default.ID().ToIDOutput().ToStringOutput(),
				InstanceClass:     pulumi.String("db.r5.large"),
			})
			if err != nil {
				return err
			}
			clusterInstances = append(clusterInstances, __res)
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_docdb_clusterinstance" "cluster_instances" {
  count              = 2
  identifier         ="docdb-cluster-demo-${count.index}"
  cluster_identifier = aws_docdb_cluster.default.id
  instance_class     = "db.r5.large"
}
resource "aws_docdb_cluster" "default" {
  cluster_identifier = "docdb-cluster-demo"
  availability_zones = ["us-west-2a", "us-west-2b", "us-west-2c"]
  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.docdb.Cluster;
import com.pulumi.aws.docdb.ClusterArgs;
import com.pulumi.aws.docdb.ClusterInstance;
import com.pulumi.aws.docdb.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("docdb-cluster-demo")
            .availabilityZones(
                "us-west-2a",
                "us-west-2b",
                "us-west-2c")
            .masterUsername("foo")
            .masterPassword("barbut8chars")
            .build());

        for (var i = 0; i < 2; i++) {
            new ClusterInstance("clusterInstances-" + i, ClusterInstanceArgs.builder()
                .identifier(String.format("docdb-cluster-demo-%s", range.value()))
                .clusterIdentifier(default_.id())
                .instanceClass("db.r5.large")
                .build());


}
    }
}
resources:
  clusterInstances:
    type: aws:docdb:ClusterInstance
    name: cluster_instances
    properties:
      identifier: docdb-cluster-demo-${range.value}
      clusterIdentifier: ${default.id}
      instanceClass: db.r5.large
    options: {}
  default:
    type: aws:docdb:Cluster
    properties:
      clusterIdentifier: docdb-cluster-demo
      availabilityZones:
        - us-west-2a
        - us-west-2b
        - us-west-2c
      masterUsername: foo
      masterPassword: barbut8chars

Import

Using pulumi import, import DocumentDB Cluster Instances using the identifier. For example:

$ pulumi import aws:docdb/clusterInstance:ClusterInstance prod_instance_1 aurora-cluster-instance-1

Constructors

ClusterInstance(String name, {ClusterInstanceArgs? args, CustomResourceOptions? options})
Creates a new ClusterInstance. name The Pulumi resource name. args Arguments used to configure this ClusterInstance. The set of arguments for ClusterInstance. options Resource options controlling this resource's behavior.
ClusterInstance.reference(String urn)
Creates a typed reference to an existing ClusterInstance resource.

Properties

applyImmediately ↔ Output<bool?>
Whether any database modifications are applied immediately, or during the next maintenance window. Default isfalse.
latefinal
arn ↔ Output<String>
ARN of cluster instance
latefinal
autoMinorVersionUpgrade ↔ Output<bool?>
Parameter does not apply to Amazon DocumentDB. Amazon DocumentDB does not perform minor version upgrades regardless of the value set (see docs). 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 certificate authority (CA) certificate for the DB instance.
latefinal
certificateRotationRestart ↔ Output<String?>
Whether to restart the DB instance when rotating its SSL/TLS certificate. By default, AWS restarts the DB instance when you rotate your SSL/TLS certificate. The certificate is not updated until the DB instance is restarted. Set to false only if you are not using SSL/TLS to connect to the DB instance.
latefinal
childResources Set<Resource>
finalinherited
clusterIdentifier ↔ Output<String>
Identifier of the aws.docdb.Cluster in which to launch this instance.
latefinal
completionSources Map<String, IOutputCompletionSource>
latefinalinherited
copyTagsToSnapshot ↔ Output<bool?>
Copy all DB instance tags to snapshots. Default is false.
latefinal
dbiResourceId ↔ Output<String>
Region-unique, immutable identifier for the DB instance.
latefinal
dbSubnetGroupName ↔ Output<String>
DB subnet group to associate with this DB instance.
latefinal
enablePerformanceInsights ↔ Output<bool?>
Value that indicates whether to enable Performance Insights for the DB Instance. Default false. See docs (https://docs.aws.amazon.com/documentdb/latest/developerguide/performance-insights.html) about the details.
latefinal
endpoint ↔ Output<String>
DNS address for this instance. May not be writable
latefinal
engine ↔ Output<String?>
Name of the database engine to be used for the DocumentDB instance. Defaults to docdb. Valid Values: docdb.
latefinal
engineVersion ↔ Output<String>
Database engine version
latefinal
hashCode int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
identifier ↔ Output<String>
The identifier for the DocumentDB instance, if omitted, the provider 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 for DocumentDB Instances. See the aws.docdb.getOrderableDbInstance data source. See AWS Documentation for complete details.
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
performanceInsightsKmsKeyId ↔ Output<String>
KMS key identifier is the key ARN, key ID, alias ARN, or alias name for the KMS key. If you do not specify a value for PerformanceInsightsKMSKeyId, then Amazon DocumentDB uses your default KMS key.
latefinal
port ↔ Output<int>
Database port
latefinal
preferredBackupWindow ↔ Output<String>
Daily time range during which automated backups are created if automated backups are enabled.
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?>
Failover Priority setting on instance level. Default 0. The reader who has lower tier has higher priority to get promoter to writer.
latefinal
publiclyAccessible ↔ Output<bool>
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>
Whether the DB cluster is encrypted.
latefinal
tags ↔ Output<Map<String, String>?>
Map of tags to assign to the instance. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
latefinal
tagsAll ↔ Output<Map<String, String>>
Map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
latefinal
transformations List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited
writer ↔ Output<bool>
Whether this instance is writable. False indicates 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 name and id.