aws

package
v0.9.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: Apache-2.0 Imports: 20 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// Ref: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-identity-documents.html
	AWSImdsUrl         = "http://169.254.169.254/latest/dynamic/instance-identity/document"
	AWSUserDataImdsUrl = "http://169.254.169.254/latest/user-data"
)

Variables

This section is empty.

Functions

func GetUserData

func GetUserData(ctx context.Context, url string) ([]byte, error)

Method to retrieve userData from the instance metadata service and return it as a string

func IsAWS

func IsAWS(ctx context.Context) bool

Method to check if the VM is running on AWS by checking if the AWS IMDS endpoint is reachable If the VM is running on AWS, return true

func NewEC2Client

func NewEC2Client(cloudCfg Config) (*ec2.Client, error)

TODO: Use IAM role

func NewProvider

func NewProvider(config *Config) (provider.Provider, error)

Types

type Config

type Config struct {
	AccessKeyId          string
	SecretKey            string
	Region               string
	LoginProfile         string
	LaunchTemplateName   string
	ImageId              string
	InstanceType         string
	KeyName              string
	SubnetId             string
	SecurityGroupIds     securityGroupIds
	UseLaunchTemplate    bool
	InstanceTypes        instanceTypes
	InstanceTypeSpecList []provider.InstanceTypeSpec
	Tags                 provider.KeyValueFlag
	UsePublicIP          bool
	RootVolumeSize       int
	RootDeviceName       string
	DisableCVM           bool
}

func (Config) Redact

func (c Config) Redact() Config

type Manager

type Manager struct{}

func (*Manager) GetConfig

func (_ *Manager) GetConfig() (config *Config)

func (*Manager) LoadEnv

func (_ *Manager) LoadEnv()

func (*Manager) NewProvider

func (_ *Manager) NewProvider() (provider.Provider, error)

func (*Manager) ParseCmd

func (_ *Manager) ParseCmd(flags *flag.FlagSet)

type MetadataRetriever

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

Jump to

Keyboard shortcuts

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