AWS Amazon EC2 Endpoint Connection Notification

This page shows how to write Terraform and CloudFormation for Amazon EC2 Endpoint Connection Notification and write them securely.

aws_vpc_endpoint_connection_notification (Terraform)

The Endpoint Connection Notification in Amazon EC2 can be configured in Terraform with the resource name aws_vpc_endpoint_connection_notification. The following sections describe 5 examples of how to use the resource and its parameters.

Example Usage from GitHub

main.tf#L7
resource "aws_vpc_endpoint_connection_notification" "this" {
  connection_events           = var.connection_events
  connection_notification_arn = var.connection_notification_arn
  vpc_endpoint_id             = var.vpc_endpoint_id
  vpc_endpoint_service_id     = var.vpc_endpoint_service_id
}
vpc_endpoint_connection_notification.tf#L4
resource "aws_vpc_endpoint_connection_notification" "vpc_endpoint_connection_notification" {
  count = var.enable_vpc_endpoint && var.vpc_endpoint_connection_notification_connection_notification_arn != "" ? 1 : 0

  connection_notification_arn = var.vpc_endpoint_connection_notification_connection_notification_arn
  connection_events           = var.vpc_endpoint_connection_notification_connection_events

vpc_endpoint_connection_notification.tf#L4
resource "aws_vpc_endpoint_connection_notification" "vpc_endpoint_connection_notification" {
  count = var.enable_vpc_endpoint_connection_notification ? (var.enable_vpc_endpoint ? length(var.vpc_endpoint_stack) : (var.enable_vpc_endpoint_service ? length(var.vpc_endpoint_service_stack) : 0)) : 0

  connection_notification_arn = var.vpc_endpoint_connection_notification_connection_notification_arn
  connection_events           = var.vpc_endpoint_connection_notification_connection_events

vpc_endpoint_connection_notification.tf#L4
resource "aws_vpc_endpoint_connection_notification" "vpc_endpoint_connection_notification" {
  count = var.enable_vpc_endpoint_connection_notification ? (var.enable_vpc_endpoint ? length(var.vpc_endpoint_stack) : (var.enable_vpc_endpoint_service ? length(var.vpc_endpoint_service_stack) : 0)) : 0

  connection_notification_arn = var.vpc_endpoint_connection_notification_connection_notification_arn
  connection_events           = var.vpc_endpoint_connection_notification_connection_events

vpc_endpoint_connection_notification.tf#L4
resource "aws_vpc_endpoint_connection_notification" "vpc_endpoint_connection_notification" {
  count = var.enable_vpc_endpoint_connection_notification ? (var.enable_vpc_endpoint ? length(var.vpc_endpoint_stack) : (var.enable_vpc_endpoint_service ? length(var.vpc_endpoint_service_stack) : 0)) : 0

  connection_notification_arn = var.vpc_endpoint_connection_notification_connection_notification_arn
  connection_events           = var.vpc_endpoint_connection_notification_connection_events

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

Provides a VPC Endpoint connection notification resource. Connection notifications notify subscribers of VPC Endpoint events.

Tips: Best Practices for The Other AWS Amazon EC2 Resources

In addition to the aws_default_vpc, AWS Amazon EC2 has the other resources that should be configured for security reasons. Please check some examples of those resources and precautions.

risk-label

aws_default_vpc

Ensure to avoid using default VPC

It is better to define the own VPC and use it.

risk-label

aws_network_acl_rule

Ensure your network ACL rule blocks unwanted inbound traffic

It is better to block unwanted inbound traffic.

risk-label

aws_ebs_volume

Ensure to use a customer-managed key for EBS volume encryption

It is better to use a customer-managed key for EBS volume encryption. It can be gain more control over the encryption by using customer-managed keys (CMK).

risk-label

aws_instance

Ensure to avoid storing AWS access keys in user data

It is better to avoid storing AWS access keys in user data. `aws_iam_instance_profile` could be used instead.

risk-label

aws_security_group

Ensure your security group blocks unwanted inbound traffic

It is better to block unwanted inbound traffic.

Review your AWS Amazon EC2 settings

In addition to the above, there are other security points you should be aware of making sure that your .tf files are protected in Shisho Cloud.

AWS::EC2::VPCEndpointConnectionNotification (CloudFormation)

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

Example Usage from GitHub

product.template-eu-north-1.yaml#L9
    Type: AWS::EC2::VPCEndpointConnectionNotification
    Description: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointconnectionnotification.html
    Properties:
      ConnectionNotificationArn: !Ref 'ConnectionNotificationArn'
product.template-ap-east-1.yaml#L9
    Type: AWS::EC2::VPCEndpointConnectionNotification
    Description: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointconnectionnotification.html
    Properties:
      ConnectionNotificationArn: !Ref 'ConnectionNotificationArn'
product.template-ap-northeast-3.yaml#L9
    Type: AWS::EC2::VPCEndpointConnectionNotification
    Description: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointconnectionnotification.html
    Properties:
      ConnectionNotificationArn: !Ref 'ConnectionNotificationArn'
product.template-us-east-1.yaml#L9
    Type: AWS::EC2::VPCEndpointConnectionNotification
    Description: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointconnectionnotification.html
    Properties:
      ConnectionNotificationArn: !Ref 'ConnectionNotificationArn'
product.template-us-east-1.yaml#L17
    Type: AWS::EC2::VPCEndpointConnectionNotification
    Description: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointconnectionnotification.html
    Properties:
      VPCEndpointId: !Ref 'VPCEndpointId'
      ServiceId: !Ref 'ServiceId'
      ConnectionNotificationArn: !Ref 'ConnectionNotificationArn'
EC2VPCEndpointConnectionNotificationSpecification.json#L3
    "AWS::EC2::VPCEndpointConnectionNotification": {
      "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointconnectionnotification.html",
      "Properties": {
        "ConnectionEvents": {
          "PrimitiveItemType": "String",
          "Type": "List",
EC2VPCEndpointConnectionNotificationSpecification.json#L3
    "AWS::EC2::VPCEndpointConnectionNotification": {
      "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointconnectionnotification.html",
      "Properties": {
        "ConnectionEvents": {
          "PrimitiveItemType": "String",
          "Type": "List",
EC2VPCEndpointConnectionNotificationSpecification.json#L3
    "AWS::EC2::VPCEndpointConnectionNotification": {
      "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointconnectionnotification.html",
      "Properties": {
        "ConnectionEvents": {
          "PrimitiveItemType": "String",
          "Type": "List",
EC2VPCEndpointConnectionNotificationSpecification.json#L3
    "AWS::EC2::VPCEndpointConnectionNotification": {
      "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointconnectionnotification.html",
      "Properties": {
        "ConnectionEvents": {
          "PrimitiveItemType": "String",
          "Type": "List",
EC2VPCEndpointConnectionNotificationSpecification.json#L3
    "AWS::EC2::VPCEndpointConnectionNotification": {
      "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointconnectionnotification.html",
      "Properties": {
        "ConnectionEvents": {
          "PrimitiveItemType": "String",
          "Type": "List",

Parameters

Explanation in CloudFormation Registry

Specifies a connection notification for a VPC endpoint or VPC endpoint service. A connection notification notifies you of specific endpoint events. You must create an SNS topic to receive notifications. For more information, see Create a Topic in the Amazon Simple Notification Service Developer Guide.

You can create a connection notification for interface endpoints only.

Frequently asked questions

What is AWS Amazon EC2 Endpoint Connection Notification?

AWS Amazon EC2 Endpoint Connection Notification is a resource for Amazon EC2 of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS Amazon EC2 Endpoint Connection Notification?

For Terraform, the niveklabs/aws, SebastianUA/terraform-aws-vpc and mehanic/homework1 source code examples are useful. See the Terraform Example section for further details.

For CloudFormation, the awslabs/aws-service-catalog-products, awslabs/aws-service-catalog-products and awslabs/aws-service-catalog-products source code examples are useful. See the CloudFormation Example section for further details.