Forum: Ruby Nested Hash AWS API Call

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
B3249573a5345f4681c66a9430e8b3bc?d=identicon&s=25 Pierre-Andre M. (pierreandre_m)
on 2013-09-13 02:10
I am trying to make a call and retrieve meaningful data via the
"describe_instance" method within the Ruby AWS SDK.  I'm pretty new to
ruby and it seems I'm missing something fundamental about nested

Here is the doc I'm using as reference

Here is how I set things up (I changed all the data):

aws_instance = @ec2.client.describe_instances(:instance_ids =>

for example, I would like to retrieve the "availability_zone" which
appears to be nested (in the documentation) within the "placement" hash
which is in the "instances" set.

Can someone form a sample call that I could use as a reference?
09a32175057418748822c587ac08c429?d=identicon&s=25 Abinoam Jr. (abinoampraxedes_m)
on 2013-09-13 23:44
(Received via mailing list)

I can guess ...

response = @ec2.client.describe_instances(:instance_ids => ['i-gggggg'])

instance =[:reservation_set].first[:instance_set].first

availability_zone = instance[:placement][:availability_zone]

Note 1: When it says "Array" it's an Array of Hashes. So, if I call
"first" on it, I have a Hash in return and I can call [] on it.
Note 2: I have no means to test this. Just let me know if it works.
This topic is locked and can not be replied to.