Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Does AWS VPC Endpoint require subnets?

I am creating an AWS VPC Endpoint to connect to an interface type of service.I am using this code for it.

resource "aws_vpc_endpoint" "endpoints" {
  for_each          = var.custom_endpoint_services
  vpc_id            = data.aws_vpc.current_vpc.id
  service_name      = each.value.service_name
  vpc_endpoint_type = "Interface"
  security_group_ids = [
       aws_security_group.endpoints-sg.id
     ]
  tags = merge(var.tags, {
         "Name" = each.key
    })
    }

Now as you can see i am not using any subnets.But still the endpoint gets created and is shown as available endpoint connections in the endpoint service.How is this possible?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

How is this possible?

You have created an endpoint in the VPC, but none of the subnets in the VPC will route traffic to it currently. The Terraform documentation even includes an example similar to the code in your question, however if you check the subnet_ids attribute documentation on that same page, it states:

Interface type endpoints cannot function without being assigned to a subnet.

So, while it allows you to create Interface Endpoints without a subnet assignment, the documentation warns you that it will not be functional.

Note that endpoints of type Gateway do not need subnet assignments in order to work.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading