Skip to content

Resource: awsNeptuneCluster

Provides an Neptune Cluster Resource. A Cluster Resource defines attributes that are applied to the entire cluster of Neptune Cluster Instances.

Changes to a Neptune Cluster can occur when you manually change a parameter, such as backupRetentionPeriod, and are reflected in the next maintenance window. Because of this, Terraform may report a difference in its planning phase because a modification has not yet taken place. You can use the applyImmediately flag to instruct the service to apply the change immediately (see documentation below).

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
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,
});

\~> Note: AWS Neptune does not support user name/password–based access control. See the AWS Docs for more information.

Argument Reference

The following arguments are supported:

  • allowMajorVersionUpgrade - (Optional) Specifies whether upgrades between different major versions are allowed. You must set it to true when providing an engineVersion parameter that uses a different major version than the DB cluster's current version. Default is false.
  • applyImmediately - (Optional) Specifies whether any cluster modifications are applied immediately, or during the next maintenance window. Default is false.
  • availabilityZones - (Optional) A list of EC2 Availability Zones that instances in the Neptune cluster can be created in.
  • backupRetentionPeriod - (Optional) The days to retain backups for. Default 1
  • clusterIdentifier - (Optional, Forces new resources) The cluster identifier. If omitted, Terraform will assign a random, unique identifier.
  • clusterIdentifierPrefix - (Optional, Forces new resource) Creates a unique cluster identifier beginning with the specified prefix. Conflicts with clusterIdentifier.
  • copyTagsToSnapshot - (Optional) If set to true, tags are copied to any snapshot of the DB cluster that is created.
  • enableCloudwatchLogsExports - (Optional) A list of the log types this DB cluster is configured to export to Cloudwatch Logs. Currently only supports audit.
  • engine - (Optional) The name of the database engine to be used for this Neptune cluster. Defaults to neptune.
  • engineVersion - (Optional) The database engine version.
  • finalSnapshotIdentifier - (Optional) The name of your final Neptune snapshot when this Neptune cluster is deleted. If omitted, no final snapshot will be made.
  • globalClusterIdentifier - (Optional) The global cluster identifier specified on awsNeptuneGlobalCluster.
  • iamRoles - (Optional) A List of ARNs for the IAM roles to associate to the Neptune Cluster.
  • iamDatabaseAuthenticationEnabled - (Optional) Specifies whether or not mappings of AWS Identity and Access Management (IAM) accounts to database accounts is enabled.
  • kmsKeyArn - (Optional) The ARN for the KMS encryption key. When specifying kmsKeyArn, storageEncrypted needs to be set to true.
  • neptuneSubnetGroupName - (Optional) A Neptune subnet group to associate with this Neptune instance.
  • neptuneClusterParameterGroupName - (Optional) A cluster parameter group to associate with the cluster.
  • neptuneInstanceParameterGroupName - (Optional) The name of the DB parameter group to apply to all instances of the DB cluster.
  • preferredBackupWindow - (Optional) The daily time range during which automated backups are created if automated backups are enabled using the BackupRetentionPeriod parameter. Time in UTC. Default: A 30-minute window selected at random from an 8-hour block of time per regionE.g., 04:00-09:00
  • preferredMaintenanceWindow - (Optional) The weekly time range during which system maintenance can occur, in (UTC) e.g., wed:04:00-wed:04:30
  • port - (Optional) The port on which the Neptune accepts connections. Default is 8182.
  • replicationSourceIdentifier - (Optional) ARN of a source Neptune cluster or Neptune instance if this Neptune cluster is to be created as a Read Replica.
  • skipFinalSnapshot - (Optional) Determines whether a final Neptune snapshot is created before the Neptune cluster is deleted. If true is specified, no Neptune snapshot is created. If false is specified, a Neptune snapshot is created before the Neptune cluster is deleted, using the value from finalSnapshotIdentifier. Default is false.
  • snapshotIdentifier - (Optional) Specifies whether or not to create this cluster from a snapshot. You can use either the name or ARN when specifying a Neptune cluster snapshot, or the ARN when specifying a Neptune snapshot.
  • storageEncrypted - (Optional) Specifies whether the Neptune cluster is encrypted. The default is false if not specified.
  • tags - (Optional) A map of tags to assign to the Neptune cluster. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
  • vpcSecurityGroupIds - (Optional) List of VPC security groups to associate with the Cluster
  • deletionProtection - (Optional) A value that indicates whether the DB cluster has deletion protection enabled.The database can't be deleted when deletion protection is enabled. By default, deletion protection is disabled.
  • serverlessV2ScalingConfiguration - (Optional) If set, create the Neptune cluster as a serverless one. See Serverless for example block attributes.

Serverless

Neptune serverless has some limitations. Please see the limitations on the AWS documentation before jumping into Neptune Serverless.

Neptune serverless requires that the engineVersion attribute must be 1201 or above. Also, you need to provide a cluster parameter group compatible with the family neptune12. In the example below, the default cluster parameter group is used.

/*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 awsNeptuneClusterExample = new aws.neptuneCluster.NeptuneCluster(
  this,
  "example",
  {
    applyImmediately: true,
    clusterIdentifier: "neptune-cluster-development",
    engine: "neptune",
    engineVersion: "1.2.0.1",
    neptuneClusterParameterGroupName: "default.neptune1.2",
    serverlessV2ScalingConfiguration: {},
    skipFinalSnapshot: true,
  }
);
const awsNeptuneClusterInstanceExample =
  new aws.neptuneClusterInstance.NeptuneClusterInstance(this, "example_1", {
    clusterIdentifier: awsNeptuneClusterExample.clusterIdentifier,
    instanceClass: "db.serverless",
    neptuneParameterGroupName: "default.neptune1.2",
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsNeptuneClusterInstanceExample.overrideLogicalId("example");
  • minCapacity: (default: 2.5) The minimum Neptune Capacity Units (NCUs) for this cluster. Must be greater or equal than 1. See AWS Documentation for more details.
  • maxCapacity: (default: 128) The maximum Neptune Capacity Units (NCUs) for this cluster. Must be lower or equal than 128. See AWS Documentation for more details.

Attributes Reference

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

  • arn - The Neptune Cluster Amazon Resource Name (ARN)
  • clusterResourceId - The Neptune Cluster Resource ID
  • clusterMembers – List of Neptune Instances that are a part of this cluster
  • endpoint - The DNS address of the Neptune instance
  • hostedZoneId - The Route53 Hosted Zone ID of the endpoint
  • id - The Neptune Cluster Identifier
  • readerEndpoint - A read-only endpoint for the Neptune cluster, automatically load-balanced across replicas
  • status - The Neptune instance status
  • tagsAll - A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.

Timeouts

Configuration options:

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

Import

awsNeptuneCluster can be imported by using the cluster identifier, e.g.,

$ terraform import aws_neptune_cluster.example my-cluster