Adding an additional static IP to elastic beanstalk instances

Viewed 63

I have a few elastic beanstalk applications on the same VPC (which can also be reduced to one application), and I'd like them to be accessible both via one IP address (both inbound and outbound traffic), and via their own URL. I've seen that this can be done via NAT, but I haven't found documentation on whether this is all traffic (in both directions) and if it can be done alongside the original endpoints. Another question is whether there is a better way to do this.

2 Answers

NAT is used to provide access to internet for instances in private subnets. In this case all instances in the subnet will have the same external IP. But you won't be able to access your private instances using that IP, it's only for outbound traffic.

In your case I'd go with a ELB. Following the best practices, keep your instances with running applications in private subnets and:

  1. Have an external facing ELB in public subnets (you'll need at least 2 public subnets in different AZs).
  2. Create a Target Group and add your instances with running apps to it.
  3. Assign the Target Group to the listener on your ELB.
  4. Configure the security groups on ELB and app instances to allow the traffic on the port the applications are serving (usually it's 8080).

As a result you'll have your instances accessible by the ELB URL. If you want to have a pretty URL, you can configure it in Route 53 and resolve it to the ELB URL.

  • Its not possible by using aws provided NAT cluster but can be achieved by hosting a box with both Load balancer and NAT running in the same instance with EIP, map your domain with that IP for incoming traffic, for outgoing traffic in the route table of private app subnet you configure the NAT as target for all the 0.0.0.0/0 route, But it is not the recommended approach since the front facing instance becomes SPOF.

  • The recommended way is using ELB as a front facing and NAT cluster as outgoing for high HA.

Related