# Ohai on a AWS VPC instance

**URL:** <https://discourse.chef.io/t/ohai-on-a-aws-vpc-instance/4923>\
**Category:** Chef Infra (archive)\
**Created:** [January 20, 2014, 7:39pm UTC](https://discourse.chef.io/t/ohai-on-a-aws-vpc-instance/4923 "2014-01-20T19:39:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Edward](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/edward/32/400_2.png) [@Edward](https://discourse.chef.io/u/Edward)\
**Post date:** [January 20, 2014, 7:39pm UTC](https://discourse.chef.io/t/ohai-on-a-aws-vpc-instance/4923/1 "2014-01-20T19:39:00Z")

</div>

Ohai Chefs!

I’m seeing an issue with running a AWS instance in a VPC that has an Elastic IP  
associated to it, the issue that I see is that I’m expecting node[cloud] and  
node[cloud][public\_ipv4] and its not there on the VPC instance.

Here is what I’m running on the VPC node:  
ii chef 11.8.2-1.ubuntu.12.04   
amd64 The full stack of chef  
root@ip-10-0-16-121:~# lsb\_release -a  
No LSB modules are available.  
Distributor ID: Ubuntu  
Description: Ubuntu 12.10  
Release: 12.10  
Codename: quantal

Quick output from a host in a VPC w/EIP and a non-VPC host w/EIP:

VPC host:  
ohai | grep cloud  
"label": “cloudimg-rootfs”  
"/dev/disk/by-label/cloudimg-rootfs": {

Non-VPC:  
ohai | grep cloud  
"cloud": {  
“label”: “cloudimg-rootfs”  
"/dev/disk/by-label/cloudimg-rootfs": {

As you can see the non-VPC host has node[cloud] and the non-vpc host does not.  
Here is a full output of ohai on the VPC host

[https://gist.github.com/edwardvfluke/8527113](https://gist.github.com/edwardvfluke/8527113)

Any Ideas on why this is happening?

Thanks,  
ev-

---

<div class="post-metadata">

**Author:** ![Eric\_Herot](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/eric_herot/32/84_2.png) [@Eric\_Herot](https://discourse.chef.io/u/Eric_Herot)\
**Post date:** [January 20, 2014, 7:45pm UTC](https://discourse.chef.io/t/ohai-on-a-aws-vpc-instance/4923/2 "2014-01-20T19:45:49Z")

</div>

Hi Edward,

Afaik that attribute is created if there is an ohai hint called 'ec2.json'. The knife-ec2 plugin automatically sets this hint during bootstrap (if you use that bootstrap method). Is it possible that the VPC nodes were bootstrapped in a way that would have skipped this step?

The relevant codey bits...  
Where knife-ec2 sets the hint:

> <https://github.com/chef/knife-ec2/blob/3ac33a5938c30002d06b3e1279ff2a660ea02897/lib/chef/knife/ec2_server_create.rb#L528>

Where the bootstrap process drops it on the node:  
[https://github.com/opscode/chef/blob/master/lib/chef/knife/bootstrap/chef-full.erb#L54](https://github.com/opscode/chef/blob/master/lib/chef/knife/bootstrap/chef-full.erb#L54)

Hope this helps…

Eric

On Jan 20, 2014, at 2:39 PM, Edward [edward@digitalnetz.net](mailto:edward@digitalnetz.net) wrote:

> Ohai Chefs!
> 
> I'm seeing an issue with running a AWS instance in a VPC that has an Elastic IP  
> associated to it, the issue that I see is that I'm expecting node[cloud] and  
> node[cloud][public\_ipv4] and its not there on the VPC instance.
> 
> Here is what I'm running on the VPC node:  
> ii chef 11.8.2-1.ubuntu.12.04   
> amd64 The full stack of chef  
> root@ip-10-0-16-121:~# lsb\_release -a  
> No LSB modules are available.  
> Distributor ID: Ubuntu  
> Description: Ubuntu 12.10  
> Release: 12.10  
> Codename: quantal
> 
> Quick output from a host in a VPC w/EIP and a non-VPC host w/EIP:
> 
> VPC host:  
> ohai | grep cloud  
> "label": "cloudimg-rootfs"  
> "/dev/disk/by-label/cloudimg-rootfs": {
> 
> Non-VPC:  
> ohai | grep cloud  
> "cloud": {  
> "label": "cloudimg-rootfs"  
> "/dev/disk/by-label/cloudimg-rootfs": {
> 
> As you can see the non-VPC host has node[cloud] and the non-vpc host does not.  
> Here is a full output of ohai on the VPC host
> 
> [https://gist.github.com/edwardvfluke/8527113](https://gist.github.com/edwardvfluke/8527113)
> 
> Any Ideas on why this is happening?
> 
> Thanks,  
> ev-

---

<div class="post-metadata">

**Author:** ![kallistec](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/kallistec/32/23_2.png) [@kallistec](https://discourse.chef.io/u/kallistec)\
**Post date:** [January 21, 2014, 6:21pm UTC](https://discourse.chef.io/t/ohai-on-a-aws-vpc-instance/4923/3 "2014-01-21T18:21:00Z")

</div>

For further explanation, VPC mode in EC2 breaks ohai’s auto detection of EC2. Ohai’s hint system is a workaround for cases where we can not reliably auto detect some feature of the platform we’re on, so you need to create a hint file as referenced in the previous post to tell ohai to gather EC2 data.

HTH,

--  
Daniel DeLeo

On Monday, January 20, 2014 at 11:45 AM, Eric Herot wrote:

> Hi Edward,
> 
> Afaik that attribute is created if there is an ohai hint called 'ec2.json'. The knife-ec2 plugin automatically sets this hint during bootstrap (if you use that bootstrap method). Is it possible that the VPC nodes were bootstrapped in a way that would have skipped this step?
> 
> The relevant codey bits...  
> Where knife-ec2 sets the hint:  
> [https://github.com/opscode/knife-ec2/blob/3ac33a5938c30002d06b3e1279ff2a660ea02897/lib/chef/knife/ec2\_server\_create.rb#L528](https://github.com/opscode/knife-ec2/blob/3ac33a5938c30002d06b3e1279ff2a660ea02897/lib/chef/knife/ec2_server_create.rb#L528)  
> Where the bootstrap process drops it on the node:  
> [https://github.com/opscode/chef/blob/master/lib/chef/knife/bootstrap/chef-full.erb#L54](https://github.com/opscode/chef/blob/master/lib/chef/knife/bootstrap/chef-full.erb#L54)
> 
> Hope this helps…
> 
> Eric
> 
> On Jan 20, 2014, at 2:39 PM, Edward \<[edward@digitalnetz.net](mailto:edward@digitalnetz.net) ([mailto:edward@digitalnetz.net](mailto:edward@digitalnetz.net))\> wrote:
> 
> > Ohai Chefs!
> > 
> > I'm seeing an issue with running a AWS instance in a VPC that has an Elastic IP  
> > associated to it, the issue that I see is that I'm expecting node[cloud] and  
> > node[cloud][public\_ipv4] and its not there on the VPC instance.
> > 
> > Here is what I'm running on the VPC node:  
> > ii chef 11.8.2-1.ubuntu.12.04  
> > amd64 The full stack of chef  
> > root@ip-10-0-16-121: ([mailto:root@ip-10-0-16-121](mailto:root@ip-10-0-16-121):)~# lsb\_release -a  
> > No LSB modules are available.  
> > Distributor ID: Ubuntu  
> > Description: Ubuntu 12.10  
> > Release: 12.10  
> > Codename: quantal
> > 
> > Quick output from a host in a VPC w/EIP and a non-VPC host w/EIP:
> > 
> > VPC host:  
> > ohai | grep cloud  
> > "label": "cloudimg-rootfs"  
> > "/dev/disk/by-label/cloudimg-rootfs": {
> > 
> > Non-VPC:  
> > ohai | grep cloud  
> > "cloud": {  
> > "label": "cloudimg-rootfs"  
> > "/dev/disk/by-label/cloudimg-rootfs": {
> > 
> > As you can see the non-VPC host has node[cloud] and the non-vpc host does not.  
> > Here is a full output of ohai on the VPC host
> > 
> > [https://gist.github.com/edwardvfluke/8527113](https://gist.github.com/edwardvfluke/8527113)
> > 
> > Any Ideas on why this is happening?
> > 
> > Thanks,  
> > ev-
