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
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
}
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
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
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
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
Parameters
-
connection_events
required - set of string -
connection_notification_arn
required - string -
id
optional computed - string -
notification_type
optional computed - string -
state
optional computed - string -
vpc_endpoint_id
optional - string -
vpc_endpoint_service_id
optional - string
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.
aws_default_vpc
Ensure to avoid using default VPC
It is better to define the own VPC and use it.
aws_network_acl_rule
Ensure your network ACL rule blocks unwanted inbound traffic
It is better to block unwanted inbound traffic.
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).
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.
aws_security_group
Ensure your security group blocks unwanted inbound traffic
It is better to block unwanted inbound traffic.
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
Type: AWS::EC2::VPCEndpointConnectionNotification
Description: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointconnectionnotification.html
Properties:
ConnectionNotificationArn: !Ref 'ConnectionNotificationArn'
Type: AWS::EC2::VPCEndpointConnectionNotification
Description: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointconnectionnotification.html
Properties:
ConnectionNotificationArn: !Ref 'ConnectionNotificationArn'
Type: AWS::EC2::VPCEndpointConnectionNotification
Description: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointconnectionnotification.html
Properties:
ConnectionNotificationArn: !Ref 'ConnectionNotificationArn'
Type: AWS::EC2::VPCEndpointConnectionNotification
Description: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointconnectionnotification.html
Properties:
ConnectionNotificationArn: !Ref 'ConnectionNotificationArn'
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'
"AWS::EC2::VPCEndpointConnectionNotification": {
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointconnectionnotification.html",
"Properties": {
"ConnectionEvents": {
"PrimitiveItemType": "String",
"Type": "List",
"AWS::EC2::VPCEndpointConnectionNotification": {
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointconnectionnotification.html",
"Properties": {
"ConnectionEvents": {
"PrimitiveItemType": "String",
"Type": "List",
"AWS::EC2::VPCEndpointConnectionNotification": {
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointconnectionnotification.html",
"Properties": {
"ConnectionEvents": {
"PrimitiveItemType": "String",
"Type": "List",
"AWS::EC2::VPCEndpointConnectionNotification": {
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointconnectionnotification.html",
"Properties": {
"ConnectionEvents": {
"PrimitiveItemType": "String",
"Type": "List",
"AWS::EC2::VPCEndpointConnectionNotification": {
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointconnectionnotification.html",
"Properties": {
"ConnectionEvents": {
"PrimitiveItemType": "String",
"Type": "List",
Parameters
-
ConnectionEvents
required - List -
VPCEndpointId
optional - String -
ServiceId
optional - String -
ConnectionNotificationArn
required - String
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.