I am running a python application which is running inside a docker container using Beanstalk in a private subnet, and I want to get the Private/Local IP of the EC2 instance. Is it possible to get the Local IP address without using curl http://169.254.169.254/latest/meta-data/local-ipv4 inside a docker container.
Although I tried docker run --net=host <image_name> but still its not accessible.
You can get the local ip of a Linux instance with this command:
hostname -I | awk '{print $1}'
For EB, use .ebexentions and write a bash script in a script_name.config to run: export HOST_IP=$(hostname -I | awk '{print $1}')
How to get EC2 instance private IP in a private subnet?