aws

package
v0.0.0-...-3bfe646 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 8 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Regions = map[RegionName]RegionMapping{
	NVirginia:   {Image: "ami-366be821"},
	Ohio:        {Image: "ami-69045e0c"},
	NCalifornia: {Image: "ami-e4c78f84"},
	Oregon:      {Image: "ami-14b07274"},
	Ireland:     {Image: "ami-46591635"},
	Frankfurt:   {Image: "ami-3be11854"},
	Tokyo:       {Image: "ami-f6bd1a97"},
	Seoul:       {Image: "ami-1ff22671"},
	Singapore:   {Image: "ami-6662c405"},
	Sydney:      {Image: "ami-5e7e433d"},
	Mumbai:      {Image: "ami-dc6115b3"},
	SPaulo:      {Image: "ami-a578e5c9"},
	London:      {Image: "ami-5c32dc3b"},
	Paris:       {Image: "ami-6c16a711"},
	Canada:      {Image: "ami-c22cafa6"},
}

Regions defines a map of supported EC2 regions to various attributes like machine image to use in any specific region.

Functions

func IsRunningOnAWS

func IsRunningOnAWS() (bool, error)

IsRunningOnAWS indicates if the current running process appears to be running on an AWS instance by checking the availability of the AWS metadata API

func SupportedInstanceTypes

func SupportedInstanceTypes(region string, instanceTypes []string) []string

SupportedInstanceTypes returns a subset of the provided instance types list without the types that are not supported in the specified region

func SupportsInstanceType

func SupportsInstanceType(region, instanceType string) bool

SupportsInstanceType returns true if instances of the specified type can be provisioned in the specified region. The reason this function exists is AWS does not provide a sane way to check this via API.

NOTE: Currently this function is aware only of certain regions/instance types that some of our customers care about and can be extended further as needed

Types

type Instance

type Instance struct {
	// ID is AWS instance id
	ID string
	// NodeName is private DNS name of the instance
	NodeName string
	// Type is instance type
	Type string

	// Region is AWS region of the instance
	Region string
	// PrivateIP is a private instance IPv4
	PrivateIP string
	// PublicIP is the instance's assigned public IP
	PublicIP string
	// contains filtered or unexported fields
}

Instance defines an AWS instance and provides access to basic attributes such as instance id, the name of the node and the list of instance tags

func NewLocalInstance

func NewLocalInstance() (*Instance, error)

NewLocalInstance creates a new Instance describing the AWS instance we are running on

func (*Instance) Tag

func (r *Instance) Tag(name string) string

Tag returns the value of the tag specified with name If the tag is not found, an empty string is returned

type RegionMapping

type RegionMapping struct {
	// Image is a reference to an Amazon Machine Image (AMI) in the specified region
	Image string
}

RegionMapping defines the data an AWS EC2 region is mapped to

type RegionName

type RegionName string

RegionName defines an AWS EC2 region by name

const (
	// NVirginia is the US east (North Virginia) region
	NVirginia RegionName = "us-east-1"
	// Ohio is the US east (Ohio) region
	Ohio RegionName = "us-east-2"
	// NCalifornia is the US west (North California) region
	NCalifornia RegionName = "us-west-1"
	// Oregon is the US west (Oregon) region
	Oregon RegionName = "us-west-2"
	// Ireland is the Europe (Ireland) region
	Ireland RegionName = "eu-west-1"
	// London is the Europe (London) region
	London RegionName = "eu-west-2"
	// Paris is the Europe (Paris) region
	Paris RegionName = "eu-west-3"
	// Canada is the Canada Central region
	Canada RegionName = "ca-central-1"
	// Beijing is the Beijing region
	Beijing RegionName = "cn-north-1"
	// Frankfurt is the Europe (Frankfurt) region
	Frankfurt RegionName = "eu-central-1"
	// Tokyo is the Asia Pacific (Tokyo) region
	Tokyo RegionName = "ap-northeast-1"
	// Seoul is the Asia Pacific (Seoul) region
	Seoul RegionName = "ap-northeast-2"
	// OsakaLocal is the Asia Pacific (Osaka) region
	OsakaLocal RegionName = "ap-northeast-3"
	// Singapore is the Asia Pacific (Singapore) region
	Singapore RegionName = "ap-southeast-1"
	// Sydney is the Asia Pacific (Sydney) region
	Sydney RegionName = "ap-southeast-2"
	// Mumbai is the Asia Pacific (Mumbai) region
	Mumbai RegionName = "ap-south-1"
	// SPaulo is the South America (São Paulo) region
	SPaulo RegionName = "sa-east-1"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL