This template sets up an AWS Neptune cluster, a cluster instance, an SNS topic, and subscribes to Neptune events related to the instance.

Terraform Template

resource "aws_neptune_cluster" "default" {
  apply_immediately = true
  backup_retention_period = 5
  cluster_identifier = "neptune-cluster-demo"
  engine = "neptune"
  iam_database_authentication_enabled = true
  preferred_backup_window = "07:00-09:00"
  skip_final_snapshot = true
}

resource "aws_neptune_cluster_instance" "example" {
  apply_immediately = true
  cluster_identifier = aws_neptune_cluster.default.id
  engine = "neptune"
  instance_class = "db.r4.large"
}

resource "aws_neptune_event_subscription" "default" {
  event_categories = ["maintenance", "availability", "creation", "backup", "restoration", "recovery", "deletion", "failover", "failure", "notification", "configuration change", "read replica"]
  name = "neptune-event-sub"
  sns_topic_arn = aws_sns_topic.default.arn
  source_ids = [aws_neptune_cluster_instance.example.id]
  source_type = "db-instance"

  tags = {
    env = "test"
  }
}

resource "aws_sns_topic" "default" {
  name = "neptune-events"
}