aws

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Region    string `json:"region"`     // AWS Region to connect to
	KeyID     string `json:"key_id"`     // AWS AMI Key ID
	SecretKey string `json:"secret_key"` // AWS AMI Secret Key

	// Optional
	AccountIDs   []string          `json:"account_ids"`   // AWS Trusted account IDs to filter vpc, subnet, sg, images, snapshots...
	InstanceTags map[string]string `json:"instance_tags"` // AWS Instance tags to use when this node provision them
}

func (*Config) Apply

func (c *Config) Apply(config []byte) error

func (*Config) Validate

func (c *Config) Validate() (err error)

type Definition

type Definition struct {
	Image         string            `json:"image"`          // Main image to use as reference
	InstanceType  string            `json:"instance_type"`  // Type of the instance from aws available list
	SecurityGroup string            `json:"security_group"` // ID of the security group to use for the instance
	Tags          map[string]string `json:"tags"`           // Tags to add during instance creation
	EncryptKey    string            `json:"encrypt_key"`    // Use specific encryption key for the new disks

	UserDataFormat string `json:"userdata_format"` // If not empty - will store the resource metadata to userdata in defined format
	UserDataPrefix string `json:"userdata_prefix"` // Optional if need to add custom prefix to the metadata key during formatting

	Requirements drivers.Requirements `json:"requirements"` // Required resources to allocate
}

*

  • Definition example:
  • image: ami-abcdef123456
  • instance_type: c6a.4xlarge
  • security_group: sg-abcdef123456
  • tags:
  • somekey: somevalue
  • requirements:
  • cpu: 16
  • ram: 32
  • disks:
  • /dev/sdb:
  • clone: snap-abcdef123456
  • network: vpc-abcdef123456

func (*Definition) Apply

func (d *Definition) Apply(definition string) error

func (*Definition) Validate

func (d *Definition) Validate() error

type Driver

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

Implements drivers.ResourceDriver interface

func (*Driver) Allocate

func (d *Driver) Allocate(definition string, metadata map[string]interface{}) (string, string, error)

*

  • Allocate Instance with provided image *
  • It selects the AMI and run instance
  • Uses metadata to fill EC2 instance userdata

func (*Driver) Deallocate

func (d *Driver) Deallocate(inst_id string) error

func (*Driver) Name

func (d *Driver) Name() string

func (*Driver) Prepare

func (d *Driver) Prepare(config []byte) error

func (*Driver) Snapshot

func (d *Driver) Snapshot(inst_id string, full bool) (string, error)

func (*Driver) Status

func (d *Driver) Status(inst_id string) string

func (*Driver) ValidateDefinition

func (d *Driver) ValidateDefinition(definition string) error

Jump to

Keyboard shortcuts

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