ElasticBeanstalk deployment on custom VPC (None of the instances are sending data)

Viewed 11

I have set up a new VPC in my AWS account, using their new wizard, which creates all the necessary resources (igw, natgw, public/private subnets, routing tables, etc.)

After spinning up tens of ElasticBeanstalk environments, I have come to conclusion that the instances are not able to reach elasticbeanstalk-health.us-east-1.amazonaws.com, and therefore EB fails the initial deployment of the environment:

enter image description here

The EB configuration:

  1. Instances are deployed to the public subnets, allocated public IP (they can reach the internet)
  2. Instances are assigned the default SGs created by EB, and also the VPC's default SG.
  3. The application load balancer is publicly available, deployed on the public subnets and can reach the instances.
    1. However, the healthcheck fails because nothing responds from the instance's side, because the EB default app is not yet installed.
    2. I can verify the load balancer can reach the instance thanks to opening a socket on the relevant port (nc -l -p 80) and seeing the LB healthcheck requests being received.

Troubleshooting further:

  1. I have SSH'ed into one of the instances and tried connecting EB's health endpoint -- without any success.

  2. Testing from my own laptop, the connection succeeds.

  3. The issue roots to the DNS resolution of the health endpoint:

    1. From my own computer: PING elasticbeanstalk-health.us-east-1.amazonaws.com (35.170.164.93)
    2. From the EB instance: PING elasticbeanstalk-health.us-east-1.amazonaws.com (10.0.154.188)
    3. The difference in IPs is not what bothers me, but what does is that on the instance the resolved IP begins with 10.0.xxx.xxx -- which is configured to be routed to _local_ in the routing tables, as the VPC's default CIDR is 10.0.0.0/16.
  4. Reminder that this is public subnet, so there's no point in associating VPC Endpoint to EB/EB-health endpoints.

I'm wondering why the EB-health hostname is resolved to such IP address, and by whom, as it definitely should be resolved a public IP address available to the internet.

1 Answers

VPC interface endpoints, unlike VPC gateway endpoints, have VPC scope, not subnet scope. It does not matter if a VPC interface endpoint is created in a single private subnet. All subnets in the VPC are affected by the endpoint.

This explains why you are resolving health checks to 10.0.154.188. So you either have to fix yoru security groups and allow your instance to communicate with the endpoint, or remove the endpoint or disable private address.

Related