ec2-metadata provides to access metadata, and you can use in outside of ec2 like in ec2
Takeshi AKIMA
gem "ec2-metadata", "~> 0.2.0"