简体   繁体   中英

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

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM