AWS Amazon Neptune Cluster Instance

This page shows how to write Terraform and CloudFormation for Amazon Neptune Cluster Instance and write them securely.

aws_neptune_cluster_instance (Terraform)

The Cluster Instance in Amazon Neptune can be configured in Terraform with the resource name aws_neptune_cluster_instance. The following sections describe 5 examples of how to use the resource and its parameters.

Example Usage from GitHub

neptune_cluster_instance_test.tf#L21
resource "aws_neptune_cluster_instance" "dbR4LargeCount2" {
  count              = 2
  cluster_identifier = aws_neptune_cluster.default.id
  engine             = "neptune"
  instance_class     = "db.r4.large"
  apply_immediately  = true
neptune_cluster_instance_test.tf#L21
resource "aws_neptune_cluster_instance" "dbR4LargeCount2" {
  count              = 2
  cluster_identifier = aws_neptune_cluster.default.id
  engine             = "neptune"
  instance_class     = "db.r4.large"
  apply_immediately  = true
main.tf#L19
resource "aws_neptune_cluster_instance" "_" {
  count              = 1
  identifier         = "pslab-cluster-instance"
  cluster_identifier = aws_neptune_cluster._.id
  engine             = "neptune"
  instance_class     = "db.t3.medium"
neptune.tf#L12
resource "aws_neptune_cluster_instance" "default" {
  count                               = 1
  cluster_identifier                  = aws_neptune_cluster.default.id
  engine                              = "neptune"
  instance_class                      = "db.t3.medium" # Smallest instance type listed for neptune https://aws.amazon.com/neptune/pricing/
  apply_immediately                   = true
neptune.tf#L12
resource "aws_neptune_cluster_instance" "default" {
  count                               = 1
  cluster_identifier                  = aws_neptune_cluster.default.id
  engine                              = "neptune"
  instance_class                      = "db.t3.medium" # Smallest instance type listed for neptune https://aws.amazon.com/neptune/pricing/
  apply_immediately                   = true

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

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][1] 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 instance_class sizes.

AWS::Neptune::DBInstance (CloudFormation)

The DBInstance in Neptune can be configured in CloudFormation with the resource name AWS::Neptune::DBInstance. The following sections describe 10 examples of how to use the resource and its parameters.

Example Usage from GitHub

serverless.yml#L63
  #     Type: AWS::Neptune::DBInstance
  #     Properties:
  #       DBClusterIdentifier: !Ref unitGraphCluster
  #       DBInstanceClass: db.t3.medium
neptune.yml#L5
    Type: AWS::Neptune::DBInstance
    Properties:
      DBInstanceClass: db.t3.medium
      DBClusterIdentifier: !Ref PalomaDBCluster

Outputs:
db.cfn.yml#L171
    Type: AWS::Neptune::DBInstance
    Properties:
      DBClusterIdentifier: !Ref NeptuneCluster
      DBInstanceClass: !Ref NeptuneInstanceClass
      DBSubnetGroupName: !Ref NeptuneSubnetGroup
      Tags:
db.cfn.yml#L171
    Type: AWS::Neptune::DBInstance
    Properties:
      DBClusterIdentifier: !Ref NeptuneCluster
      DBInstanceClass: !Ref NeptuneInstanceClass
      DBSubnetGroupName: !Ref NeptuneSubnetGroup
      Tags:
db.cfn.yml#L171
    Type: AWS::Neptune::DBInstance
    Properties:
      DBClusterIdentifier: !Ref NeptuneCluster
      DBInstanceClass: !Ref NeptuneInstanceClass
      DBSubnetGroupName: !Ref NeptuneSubnetGroup
      Tags:
with_encryption_false_boolean.json#L17
      "Type" : "AWS::Neptune::DBInstance",
      "Properties" :
      {
        "DBClusterIdentifier" : "neptune-test-cluster",
        "DBInstanceClass" : "db.r4.large"
      },
with_encryption_false_string.json#L17
      "Type" : "AWS::Neptune::DBInstance",
      "Properties" :
      {
        "DBClusterIdentifier" : "neptune-test-cluster",
        "DBInstanceClass" : "db.r4.large"
      },
with_encryption.json#L17
      "Type" : "AWS::Neptune::DBInstance",
      "Properties" :
      {
        "DBClusterIdentifier" : "neptune-test-cluster",
        "DBInstanceClass" : "db.r4.large"
      },
with_no_encryption.json#L16
      "Type" : "AWS::Neptune::DBInstance",
      "Properties" :
      {
        "DBClusterIdentifier" : "neptune-test-cluster",
        "DBInstanceClass" : "db.r4.large"
      },
with_no_encryption.json#L16
      "Type" : "AWS::Neptune::DBInstance",
      "Properties" :
      {
        "DBClusterIdentifier" : "neptune-test-cluster",
        "DBInstanceClass" : "db.r4.large"
      },

Parameters

Explanation in CloudFormation Registry

The AWS::Neptune::DBInstance type creates an Amazon Neptune DB instance. Updating DB Instances You can set a deletion policy for your DB instance to control how AWS CloudFormation handles the instance when the stack is deleted. For Neptune DB instances, you can choose to retain the instance, to delete the instance, or to create a snapshot of the instance. The default AWS CloudFormation behavior depends on the DBClusterIdentifier property:+ For AWS::Neptune::DBInstance resources that don't specify the DBClusterIdentifier property, AWS CloudFormation saves a snapshot of the DB instance.

  • For AWS::Neptune::DBInstance resources that do specify the DBClusterIdentifier property, AWS CloudFormation deletes the DB instance. Deleting DB Instances Important If a DB instance is deleted or replaced during an update, AWS CloudFormation deletes all automated snapshots. However, it retains manual DB snapshots. During an update that requires replacement, you can apply a stack policy to prevent DB instances from being replaced.

When properties labeled Update requires: Replacement are updated, AWS CloudFormation first creates a replacement DB instance, changes references from other dependent resources to point to the replacement DB instance, and finally deletes the old DB instance.

Important We highly recommend that you take a snapshot of the database before updating the stack. If you don't, you lose the data when AWS CloudFormation replaces your DB instance. To preserve your data, perform the following procedure: Deactivate any applications that are using the DB instance so that there's no activity on the DB instance.

Create a snapshot of the DB instance.

If you want to restore your instance using a DB snapshot, modify the updated template with your DB instance changes and add the DBSnapshotIdentifier property with the ID of the DB snapshot that you want to use.

Update the stack.

Frequently asked questions

What is AWS Amazon Neptune Cluster Instance?

AWS Amazon Neptune Cluster Instance is a resource for Amazon Neptune of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS Amazon Neptune Cluster Instance?

For Terraform, the gilyas/infracost, infracost/infracost and ps-interactive/labs-shared-terraform source code examples are useful. See the Terraform Example section for further details.

For CloudFormation, the jammymalina/converter-rust, Pappa/Paloma and rnzsgh/compute-example-python-cfn source code examples are useful. See the CloudFormation Example section for further details.