# Private IPs vs Public Ips

**URL:** <https://discourse.chef.io/t/private-ips-vs-public-ips/19357>\
**Category:** Core Development\
**Created:** [March 16, 2018, 9:17pm UTC](https://discourse.chef.io/t/private-ips-vs-public-ips/19357 "2018-03-16T21:17:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nellshamrell](https://avatars.discourse-cdn.com/v4/letter/n/7ea924/32.png) [@nellshamrell](https://discourse.chef.io/u/nellshamrell)\
**Post date:** [March 16, 2018, 9:17pm UTC](https://discourse.chef.io/t/private-ips-vs-public-ips/19357/1 "2018-03-16T21:17:09Z")

</div>

Hello! I’ve noticed something when using sys.ip in bindings:

[https://www.habitat.sh/docs/reference/#sys](https://www.habitat.sh/docs/reference/#sys)

It seems that sys.ip always returns the private IP of an AWS instance, rather than the public IP. Is there any way to specify that this should be the public IP for the instance, rather than the private IP?

---

<div class="post-metadata">

**Author:** ![eeyun1](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/eeyun1/32/2658_2.png) [@eeyun1](https://discourse.chef.io/u/eeyun1)\
**Post date:** [March 19, 2018, 1:55pm UTC](https://discourse.chef.io/t/private-ips-vs-public-ips/19357/2 "2018-03-19T13:55:32Z")

</div>

I _think_ some other folks have run into this. But I can’t for the life of me remember what the solution was. Effectively I think that we try to make a determination about which nic is the “primary” interface and that’s what gets assigned to sys.ip. I’m not certain if theres a way around that. Would be good to get some input from @christophermaier and @reset.

---

<div class="post-metadata">

**Author:** ![bdangit](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/bdangit/32/1466_2.png) [@bdangit](https://discourse.chef.io/u/bdangit)\
**Post date:** [March 23, 2018, 4:50am UTC](https://discourse.chef.io/t/private-ips-vs-public-ips/19357/3 "2018-03-23T04:50:52Z")

</div>

Long ago I saw the code and it was hardcoded. Depending on when you need it, you could make use of ifconfig to bash scrape the other IPs. Then somehow feed it to a template or perhaps an environment var.
