Ed Sullivan
Ed Sullivan

Reputation: 738

How can I access opsworks elb layer ip from custom chef recipes

I am trying to access the elb ip address from other layers in my chef recipes to write to a conf file in multiple instances.

node[:opsworks][:layers][:layer_name][:instances][:instance_name]

only returns the app instances and not the elb address fronting them

Upvotes: 0

Views: 371

Answers (1)

Ed Sullivan
Ed Sullivan

Reputation: 738

After reading more of the documentation(http://docs.aws.amazon.com/opsworks/latest/userguide/workingcookbook-json.html#workingcookbook-json-obtain), I figured out that I could look at my chef stack configuration and deployment json file directly once I ssh'd into a machine.

Once I got the file, I realized that there is a field parallel to node[:opsworks][:layers][:layer_name][:instances] called node[:opsworks][:layers][:layer_name]["elb-load-balancers"] that contains an array of objects each with a "dns_name" field name for the load balancers in that layer.

Hope this helps someone else in the future!

Upvotes: 4

Related Questions