Skip to content

Resource: awsNeptuneClusterInstance

A Cluster Instance Resource defines attributes that are specific to a single instance in a Neptune Cluster.

You can simply add neptune instances and Neptune manages the replication. You can use the count meta-parameter to make multiple instances and join them all to the same Neptune Cluster, or you may specify different Cluster Instance resources with various instanceClass sizes.

Example Usage

The following example will create a neptune cluster with two neptune instances(one writer and one reader).

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsNeptuneClusterDefault = new aws.neptuneCluster.NeptuneCluster(
  this,
  "default",
  {
    applyImmediately: true,
    backupRetentionPeriod: 5,
    clusterIdentifier: "neptune-cluster-demo",
    engine: "neptune",
    iamDatabaseAuthenticationEnabled: true,
    preferredBackupWindow: "07:00-09:00",
    skipFinalSnapshot: true,
  }
);
const awsNeptuneClusterInstanceExample =
  new aws.neptuneClusterInstance.NeptuneClusterInstance(this, "example", {
    applyImmediately: true,
    clusterIdentifier: awsNeptuneClusterDefault.id,
    engine: "neptune",
    instanceClass: "db.r4.large",
  });
/*In most cases loops should be handled in the programming language context and 
not inside of the Terraform context. If you are looping over something external, e.g. a variable or a file input
you should consider using a for loop. If you are looping over something only known to Terraform, e.g. a result of a data source
you need to keep this like it is.*/
awsNeptuneClusterInstanceExample.addOverride("count", 2);

Argument Reference

The following arguments are supported:

  • applyImmediately - (Optional) Specifies whether any instance modifications are applied immediately, or during the next maintenance window. Default isfalse.
  • autoMinorVersionUpgrade - (Optional) Indicates that minor engine upgrades will be applied automatically to the instance during the maintenance window. Default is true.
  • availabilityZone - (Optional) The EC2 Availability Zone that the neptune instance is created in.
  • clusterIdentifier - (Required) The identifier of the awsNeptuneCluster in which to launch this instance.
  • engine - (Optional) The name of the database engine to be used for the neptune instance. Defaults to neptune. Valid Values: neptune.
  • engineVersion - (Optional) The neptune engine version.
  • identifier - (Optional, Forces new resource) The identifier for the neptune instance, if omitted, Terraform will assign a random, unique identifier.
  • identifierPrefix - (Optional, Forces new resource) Creates a unique identifier beginning with the specified prefix. Conflicts with identifier.
  • instanceClass - (Required) The instance class to use.
  • neptuneSubnetGroupName - (Required if publiclyAccessible =False, Optional otherwise) A subnet group to associate with this neptune instance. NOTE: This must match the neptuneSubnetGroupName of the attached awsNeptuneCluster.
  • neptuneParameterGroupName - (Optional) The name of the neptune parameter group to associate with this instance.
  • port - (Optional) The port on which the DB accepts connections. Defaults to 8182.
  • preferredBackupWindow - (Optional) The daily time range during which automated backups are created if automated backups are enabled. Eg: "04:00-09:00"
  • preferredMaintenanceWindow - (Optional) The window to perform maintenance in. Syntax: "ddd:hh24:mi-ddd:hh24:mi". Eg: "Mon:00:00-Mon:03:00".
  • promotionTier - (Optional) Default 0. Failover Priority setting on instance level. The reader who has lower tier has higher priority to get promoter to writer.
  • publiclyAccessible - (Optional) Bool to control if instance is publicly accessible. Default is false.
  • tags - (Optional) A 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.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • address - The hostname of the instance. See also endpoint and port.
  • arn - Amazon Resource Name (ARN) of neptune instance
  • dbiResourceId - The region-unique, immutable identifier for the neptune instance.
  • endpoint - The connection endpoint in address:port format.
  • id - The Instance identifier
  • kmsKeyArn - The ARN for the KMS encryption key if one is set to the neptune cluster.
  • storageEncrypted - Specifies whether the neptune cluster is encrypted.
  • tagsAll - A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
  • writer – Boolean indicating if this instance is writable. false indicates this instance is a read replica.

Timeouts

Configuration options:

  • create - (Default 90M)
  • update - (Default 90M)
  • delete - (Default 90M)

Import

awsNeptuneClusterInstance can be imported by using the instance identifier, e.g.,

$ terraform import aws_neptune_cluster_instance.example my-instance