0

I have Elastic Beanstalk instances accessible through an ALB in public subnets and want to assign them a single IP address (A partner asked us for an IP to whitelist to access their services)

I have followed https://medium.com/@obezuk/how-to-use-elastic-beanstalk-with-an-ip-whitelisted-api-69a6f8b5f844 i.e.

  • created a new subnet, NAT gateway and route table
  • route all traffic of the new NAT subnet to the internet gateway in the NAT route table
  • route all traffic from the public subnets hosting the EC2 instances in the main route table

but then no traffic reaches my EC2 instances. I know that the NAT gateway's use case is for instances in private subnet to reach the internet, but do you know why that might happen when everything is in public subnets?

1 Answer 1

2

I think I found out why: by changing the main route table, I made all public subnets private, so the ELB was not in a public subnet anymore and could not serve requests.

Here is what I did to setup the fixed IP:

  • Create a NAT gateway in a public subnet
  • Create new private subnets (one for each AZ)
  • Create a route table with the default route pointing to the NAT gateway
  • Associate the private subnets to the new route table
  • Change subnets in the Elastic Beanstalk configuration to use the private subnets. The autoscaling group will create new instances in the private subnets before terminating the old instances so there should be little to no downtime

This way all other resources in public subnets (ELB, RDS) are not affected

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .