Detect Cloud Provider from Instance Metadata
Go Python Shell
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
cmd
hack
internal
vendor/github.com
.gitignore
LICENSE
README.md
glide-slow
glide.lock
glide.yaml
lib.go

README.md

WebsiteSlackForumTwitter

CloudID

Detect Cloud Provider from Instance Metadata

Motivation

Kubernetes has the concept of a Cloud Provider, which is a module which provides an interface for managing TCP Load Balancers, Nodes (Instances) and Networking Routes. This library can be used to identify cloud provider based on various instance metadata without requiring user input.

Supported Cloud Providers

Id Name Technique
aws Amazon Web Services Instance Identity Documents
azure Microsoft Azure Instance info
digitalocean DigitalOcan Droplet metadata
gce Google Cloud Platform GCE Instance metadata
linode Linode Reverse domain name(PTR record)
scaleway Scaleway Instance user data
softlayer IBM Softlayer(Bluemix) Instance user metadata
vultr Vultr Instance metadata

Please file an issue if you would have ideas to improve detection technique or add support for additional cloud providers. Pull requests are welcome.

Documentation

https://godoc.org/github.com/appscode/cloudid

Example

package main

import (
    "fmt"

    "github.com/appscode/cloudid"
)

func main() {
    fmt.Println("Cloud Provider:", cloudid.Detect())
}