Project

aws_info

0.0
No commit activity in last 3 years
No release in over 3 years
A gem to provide an easy way to load the AWS information from a given AWS instance. Automatically detect server IP, Region, Availability Zone, etc. as well as instance tags
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.8
~> 10.0
 Project Readme

AwsInfo

A gem to provide an easy way to load the AWS information from a given AWS instance. Automatically detect server IP, Region, Availability Zone, etc. as well as instance tags.

Under the hood this gem uses the aws meta data lookup url for instance information: http://169.254.169.254/latest/dynamic/instance-identity/document

And it uses aws describe tags command on the aws server to get a list of tags: "aws ec2 describe-tags ..."

Installation

Add this line to your application's Gemfile:

gem 'aws_info'

And then execute:

$ bundle

Or install it yourself as:

$ gem install aws_info

Usage

require 'aws_info'

AwsInfo.region
#=> "us-east-1"

AwsInfo.ip
#=> "10.10.10.10"

AwsInfo.availability_zone
#=> "us-east-1b"

AwsInfo.instance_id
#=> "i-00000000"

AwsInfo.instance_type
#=> "t2.micro"

AwsInfo.version
#=> "2015-1-21"

AwsInfo.dev_pay_product_codes
#=> nil

AwsInfo.billing_products
#=>  nil

AwsInfo.account_id
#=> "00000000000"

AwsInfo.pending_time
#=> "2015-09-04T19:03:47Z"

AwsInfo.image_id
#=> "ami-c8888888"

AwsInfo.kernel_id
#=> nil

AwsInfo.ram_disk_id
#=> nil

AwsInfo.architecture
#=> "x86_64"

AwsInfo.tags
#=> { 'my_tag' => 'my tag's value!'}

# Access a single tag
AwsInfo.tags['my_tag']
#=> "my tag's value!"

Contributing

  1. Fork it ( https://github.com/thomas07vt/aws_info/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request