-->

Thursday, July 14, 2016

Proxy server instance id instance of ec2-instance

If you are using the awscli to write your scripts than while checking the ec2 instance id from the instance you might be using the following command

 wget -q -O - http://169.254.169.254/latest/meta-data/instance-id  

The problem is if you are having your server on private subnet and using a proxy to connect to internet and if you use the above command it would give you the proxy server id instead of your instance-id. To overcome this issue use the following while writing your script.

 export NO_PROXY=169.254.169.254;  

The resolves the ip 169.254.169.254 from the instance and does not forward it to the proxy and you would get the instance id of the instance rather than the proxy server.


0 comments:

Post a Comment