We had the same issue and ended up going the same route you mentioned in your comment -- hardcoding the private ipv4 in a route53 record.
However we were able to automate the process, mostly:
Add EB ENVs to target Route 53 Record
Find the Hosted Zone ID for the domain you'll be updating. Will be listed in the Hosted Zones section of Route 53 and look like Z1GP4MFDYUK339
Choose a Record Name that you'll want to update within that zone. Will be like subdomain.example.com
In your Elastic Beanstalk Environment properties add the following:
HOSTED_ZONE --> Hosted Zone ID APP_DOMAIN --> Record Name
In your app's project (root) directory create the following file
.ebextensions/99_dns.config
The contents of 99_dns.config:
commands: 01_update_r53: command: | IP=$(curl --silent http://169.254.169.254/latest/meta-data/local-ipv4) APP_DOMAIN=$(/opt/elasticbeanstalk/bin/get-config environment -k APP_DOMAIN) HOSTED_ZONE=$(/opt/elasticbeanstalk/bin/get-config environment -k HOSTED_ZONE) echo "{\"Comment\":\"Update IP\",\"Changes\":[{\"Action\": \"UPSERT\",\"ResourceRecordSet\":{\"Name\":\""$APP_DOMAIN".\",\"Type\":\"A\",\"TTL\":60,\"ResourceRecords\":[{\"Value\":\""$IP"\"}]}}]}" > awsr53.json aws route53 change-resource-record-sets \ --hosted-zone-id "$HOSTED_ZONE" \ --change-batch file://awsr53.json
When your application is deployed it will:
- query for its local (private) IP address
- get the
APP_DOMAIN and HOSTED_ZONE values you set from ENVs - use the
aws cli to create/update the record at HOSTED_ZONE@RECORD to be an A record with a value of the private address