项目作者: pinpt

项目描述 :
This container can be run in a cloud environment to attempt to discover metadata about the Cloud Provider from the host
高级语言: Shell
项目地址: git://github.com/pinpt/cloud-metadata.git
创建时间: 2017-03-04T17:15:57Z
项目社区:https://github.com/pinpt/cloud-metadata

开源协议:

下载


Cloud Metadata Discovery

This container can be run in a cloud environment to attempt to discover metadata about the Cloud Provider from the host.

Right now, only Amazon AWS and Google Cloud are supported. More cloud providers needed. Please send a Pull Request! :)

Run

Run such as:

  1. docker run -it --rm --net=host pinpt/cloud-metadata

NOTE: You’ll need to run the container on the host network to get right information.

Will return information as JSON (if found) and exit with 0 or exit with 1 if no cloud provider could be resolved.

Example output for AWS (the actual output will be compressed on one line for easier parsing):

  1. {
  2. "provider":"amazonec2",
  3. "public_ipaddress":"50.116.21.11",
  4. "private_ipaddress":"10.0.1.1",
  5. "hostname": "ec2-50-116-21-11.us-west-2.compute.amazonaws.com",
  6. "zone":"us-west-2c",
  7. "id":"i-9912334",
  8. "type":"c3.xlarge"
  9. }

Example output for Google Cloud Engine (the actual output will be compressed on one line for easier parsing):

  1. {
  2. "provider":"gce",
  3. "hostname":"gce-test1.c.foo-9160.internal",
  4. "public_ipaddress":"114.197.97.113",
  5. "private_ipaddress":"11.128.0.2",
  6. "zone":"us-central1-a",
  7. "id":"9741257677298391091",
  8. "type":"n1-standard-1"
  9. }

TODO

These https://ahmetalpbalkan.com/blog/comparison-of-instance-metadata-services/ and http://priocept.com/2017/02/12/aws-ec2-vs-google-compute-engine-comparison-instance-metadata/ are helpful

License

Copyright (c) 2018 PinPT, Inc. Licensed under the MIT License