Skip to content

koding/ec2dynamicdata

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

EC2Dynamicdata GoDoc

ec2dynamicdata is an handy package to retrieve the ec2 dynamic data and meta data information via simple API. The API can change in the future, please vendor it in your code base.

Install

go get github.com/koding/ec2dynamicdata

Usage

There are two main functions, one for dynamicdata and one for metadata. Below is an example code usage:

data, _ := ec2dynamicdata.Get()
/* data output:
{
  "accountId" : "123456789",
  "instanceId" : "i-abc123",
  "billingProducts" : null,
  "instanceType" : "t2.micro",
  "imageId" : "ami-9871234",
  "kernelId" : null,
  "ramdiskId" : null,
  "architecture" : "x86_64",
  "pendingTime" : "2015-07-21T09:10:42Z",
  "region" : "eu-west-1",
  "version" : "2010-08-31",
  "availabilityZone" : "eu-west-1b",
  "devpayProductCodes" : null,
  "privateIp" : "10.0.123.456"
}
*/

fmt.Println(data.ImageID)  // ami-9871234
fmt.Println(data.AccountID // 123456789

amiID, _ := ec2dynamicdata.GetMetadata(ec2dynamicdata.AmiId)
instanceID, _ := ec2dynamicdata.GetMetadata(ec2dynamicdata.InstanceId)
// and so on ...

License

The MIT License (MIT) - see LICENSE.md for more details

About

EC2 dynamic and meta data Go package

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages