---
subcategory: "Neptune"
layout: "aws"
page_title: "AWS: aws_neptune_event_subscription"
description: |-
  Provides a Neptune event subscription resource.
---

# Resource: aws_neptune_event_subscription

## Example Usage

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

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

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

resource "aws_neptune_event_subscription" "default" {
  name          = "neptune-event-sub"
  sns_topic_arn = aws_sns_topic.default.arn

  source_type = "db-instance"
  source_ids  = [aws_neptune_cluster_instance.example.id]

  event_categories = [
    "maintenance",
    "availability",
    "creation",
    "backup",
    "restoration",
    "recovery",
    "deletion",
    "failover",
    "failure",
    "notification",
    "configuration change",
    "read replica",
  ]

  tags = {
    "env" = "test"
  }
}
```

## Argument Reference

The following arguments are supported:

* `enabled` - (Optional) A boolean flag to enable/disable the subscription. Defaults to true.
* `event_categories` - (Optional) A list of event categories for a `source_type` that you want to subscribe to. Run `aws neptune describe-event-categories` to find all the event categories.
* `name` - (Optional) The name of the Neptune event subscription. By default generated by Terraform.
* `name_prefix` - (Optional) The name of the Neptune event subscription. Conflicts with `name`.
* `sns_topic_arn` - (Required) The ARN of the SNS topic to send events to.
* `source_ids` - (Optional) A list of identifiers of the event sources for which events will be returned. If not specified, then all sources are included in the response. If specified, a `source_type` must also be specified.
* `source_type` - (Optional) The type of source that will be generating the events. Valid options are `db-instance`, `db-security-group`, `db-parameter-group`, `db-snapshot`, `db-cluster` or `db-cluster-snapshot`. If not set, all sources will be subscribed to.
* `tags` - (Optional) A map of tags to assign to the resource.

## Attributes

The following additional atttributes are provided:

* `id` - The name of the Neptune event notification subscription.
* `arn` - The Amazon Resource Name of the Neptune event notification subscription.
* `customer_aws_id` - The AWS customer account associated with the Neptune event notification subscription.

## Timeouts

`aws_neptune_event_subscription` provides the following [Timeouts](/docs/configuration/resources.html#timeouts)
configuration options:

- `create` - (Default `40m`) How long to wait for creating event subscription to become available.
- `delete` - (Default `40m`) How long to wait for deleting event subscription to become fully deleted.
- `update` - (Default `40m`) How long to wait for updating event subscription to complete updates.

## Import

`aws_neptune_event_subscription` can be imported by using the event subscription name, e.g.

```
$ terraform import aws_neptune_event_subscription.example my-event-subscription
```
