aws

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2019 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const ContainerLinuxDiskSizeGiB = 8

The default size of Container Linux disks on AWS, in GiB. See discussion in https://github.com/coreos/mantle/pull/944

Variables

View Source
var (
	NoRegionPVSupport = errors.New("Region does not support PV")
)

Functions

func RegionSupportsPV added in v0.8.0

func RegionSupportsPV(region string) bool

Types

type API

type API struct {
	// contains filtered or unexported fields
}

func New

func New(opts *Options) (*API, error)

New creates a new AWS API wrapper. It uses credentials from any of the standard credentials sources, including the environment and the profile configured in ~/.aws. No validation is done that credentials exist and before using the API a preflight check is recommended via api.PreflightCheck Note that this method may modify Options to update the AMI ID

func (*API) AddKey

func (a *API) AddKey(name, key string) error

func (*API) CopyImage added in v0.4.0

func (a *API) CopyImage(sourceImageID string, regions []string) (map[string]string, error)

func (*API) CreateHVMImage added in v0.4.0

func (a *API) CreateHVMImage(snapshotID string, diskSizeGiB uint, name string, description string) (string, error)

func (*API) CreateImportRole added in v0.4.0

func (a *API) CreateImportRole(bucket string) error

func (*API) CreateInstances

func (a *API) CreateInstances(name, keyname, userdata string, count uint64) ([]*ec2.Instance, error)

CreateInstances creates EC2 instances with a given name tag, optional ssh key name, user data. The image ID, instance type, and security group set in the API will be used. CreateInstances will block until all instances are running and have an IP address.

func (*API) CreatePVImage added in v0.4.0

func (a *API) CreatePVImage(snapshotID string, diskSizeGiB uint, name string, description string) (string, error)

func (*API) CreateSnapshot added in v0.4.0

func (a *API) CreateSnapshot(imageName, sourceURL string, format EC2ImageFormat) (*Snapshot, error)

CreateSnapshot creates an AWS Snapshot

func (*API) CreateTags added in v0.4.0

func (a *API) CreateTags(resources []string, tags map[string]string) error

func (*API) DeleteKey

func (a *API) DeleteKey(name string) error

func (*API) DeleteObject added in v0.5.0

func (a *API) DeleteObject(bucket, path string) error

func (*API) FindImage added in v0.5.0

func (a *API) FindImage(name string) (string, error)

Find an image we own with the specified name. Return ID or "".

func (*API) FindSnapshot added in v0.5.0

func (a *API) FindSnapshot(imageName string) (*Snapshot, error)

Look up a Snapshot by name. Return nil if not found.

func (*API) GC added in v0.8.0

func (a *API) GC(gracePeriod time.Duration) error

GC removes AWS resources that are at least gracePeriod old. It attempts to only operate on resources that were created by a mantle tool.

func (*API) GetConsoleOutput added in v0.6.0

func (a *API) GetConsoleOutput(instanceID string) (string, error)

GetConsoleOutput returns the console output. Returns "", nil if no logs are available.

func (*API) GrantLaunchPermission added in v0.5.0

func (a *API) GrantLaunchPermission(imageID string, userIDs []string) error

func (*API) InitializeBucket added in v0.4.0

func (a *API) InitializeBucket(bucket string) error

func (*API) PreflightCheck added in v0.4.0

func (a *API) PreflightCheck() error

PreflightCheck validates that the aws configuration provided has valid credentials

func (*API) PublishImage added in v0.5.0

func (a *API) PublishImage(imageID string) error

Grant everyone launch permission on the specified image and create-volume permission on its underlying snapshot.

func (*API) TerminateInstances added in v0.6.0

func (a *API) TerminateInstances(ids []string) error

TerminateInstances schedules EC2 instances to be terminated.

func (*API) UploadObject added in v0.4.0

func (a *API) UploadObject(r io.Reader, bucket, path string, force bool) error

UploadObject uploads an object to S3

type EC2ImageFormat added in v0.4.0

type EC2ImageFormat string
const (
	EC2ImageFormatRaw  EC2ImageFormat = ec2.DiskImageFormatRaw
	EC2ImageFormatVmdk EC2ImageFormat = ec2.DiskImageFormatVmdk
)

func (*EC2ImageFormat) Set added in v0.4.0

func (e *EC2ImageFormat) Set(s string) error

func (*EC2ImageFormat) String added in v0.4.0

func (e *EC2ImageFormat) String() string

func (*EC2ImageFormat) Type added in v0.4.0

func (e *EC2ImageFormat) Type() string

type EC2ImageType added in v0.4.0

type EC2ImageType string
const (
	EC2ImageTypeHVM EC2ImageType = "hvm"
	EC2ImageTypePV  EC2ImageType = "paravirtual"
)

type Options

type Options struct {
	*platform.Options
	// The AWS region regional api calls should use
	Region string

	// The path to the shared credentials file, if not ~/.aws/credentials
	CredentialsFile string
	// The profile to use when resolving credentials, if applicable
	Profile string

	// AccessKeyID is the optional access key to use. It will override all other sources
	AccessKeyID string
	// SecretKey is the optional secret key to use. It will override all other sources
	SecretKey string

	// AMI is the AWS AMI to launch EC2 instances with.
	// If it is one of the special strings alpha|beta|stable, it will be resolved
	// to an actual ID.
	AMI                string
	InstanceType       string
	SecurityGroup      string
	IAMInstanceProfile string
}

type Snapshot added in v0.4.0

type Snapshot struct {
	SnapshotID string
}

Jump to

Keyboard shortcuts

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