Figured it out. Basically the answer is that you set up an internal load balancer, but it's a bit more complicated because Elastic Beanstalk requires you to configure your network in a specific way.
Here are the steps:
- Create a public subnet to be your DMZ.
- Create a NAT gateway that lives in your public subnet.
- Create a routing table for your public subnet that routes all intra-VPC traffic to the VPC's CIDR block and 0.0.0.0/0 to your internet gateway.
- Create a routing tables for the private subnets (where your EB applications will run) that routes intra-VPC traffic to the VPC's CIDR block and 0.0.0.0/0 to the nat address.
- Wait ~5 minutes for your changes to propagate.
- Go to Configuration -> Scaling and select that you want to enable load balancing.
- When it give you options to modify: don't change anything about the ELB and EC2 instances' subnets! I think it's a bug in the UI, but if you click any of the checkboxes, it will only allow you to have an ELB or an EC2 instance in that availability zone's subnet, but then the page will error out because you need one of each. Finally, select the option to have an "Internal" load balancer.
- Select save and wait for your config to update.
At that point, secret-server.us-east-1.elasticbeanstalk.com will resolve to a private IP.
If you enable the private load balancer but don't set up the NAT gateway, routes, and subnets, secret-server.us-east-1.elasticbeanstalk.com will resolve to a private IP. Unfortunately, your service will also transition to Severely Degraded and have no logs available (unless you pre-configured your network in ways that seem unlikely). This is because Elastic Beanstalk, when it starts up an EC2 instance, downloads some setup scripts from S3. However, your load-balanced Elastic Beanstalk EC2 instances will not be able to reach the internet, even if you haven't restricted outbound communication in security groups, because they won't have public IPs.
The solution is to set up a NAT gateways that all of your private subnets route to and a "DMZ" subnet that hosts the gateway and can actually access the internet. Amazon's docs have an example of this: VPC with Public and Private Subnets (NAT):
The instances in the public subnet can send outbound traffic directly to the Internet, whereas the instances in the private subnet can't. Instead, the instances in the private subnet can access the Internet by using a network address translation (NAT) gateway that resides in the public subnet.
I really feel like Elastic Beanstalk could maybe do some of this for you or at least document it better, but whatever. At least it's working.
secret-serverwhen you create the instance. You can also add an internal DNS zone to the VPC and point DNS records at it.ping secret-server.my-cluster.aireturnsPING secret-server.my-cluster.ai (<PUBLIC IP>) 56(84) bytes of data.).