aws

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoInstanceState         = errors.New("unable to get instance state")
	ErrNoAddressFound          = errors.New("unable to get public IP address info on AWS")
	ErrNodeNotFoundToBeRunning = errors.New("node not found to be running")
)

Functions

func CheckIPInSg added in v1.5.0

func CheckIPInSg(sg *types.SecurityGroup, currentIP string, port int32) bool

CheckIPInSg checks if the IP is present in the SecurityGroup.

Types

type AwsCloud

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

func NewAwsCloud

func NewAwsCloud(awsProfile, region string) (*AwsCloud, error)

NewAwsCloud creates an AWS cloud

func (*AwsCloud) AddSecurityGroupRule

func (c *AwsCloud) AddSecurityGroupRule(groupID, direction, protocol, ip string, port int32) error

AddSecurityGroupRule adds a rule to the given security group

func (*AwsCloud) AssociateEIP

func (c *AwsCloud) AssociateEIP(instanceID, allocationID string) error

AssociateEIP associates an Elastic IP address with an EC2 instance.

func (*AwsCloud) ChangeInstanceType added in v1.5.2

func (c *AwsCloud) ChangeInstanceType(instanceID, instanceType string) error

ChangeInstanceType resizes the given instance to the new instance type.

func (*AwsCloud) CheckKeyPairExists

func (c *AwsCloud) CheckKeyPairExists(kpName string) (bool, error)

CheckKeyPairExists checks if the specified key pair exists in the AWS Cloud.

func (*AwsCloud) CheckSecurityGroupExists

func (c *AwsCloud) CheckSecurityGroupExists(sgName string) (bool, types.SecurityGroup, error)

CheckSecurityGroupExists checks if the given security group exists

func (*AwsCloud) CreateAndDownloadKeyPair

func (c *AwsCloud) CreateAndDownloadKeyPair(keyName string, privateKeyFilePath string) error

CreateAndDownloadKeyPair creates a new key pair and downloads the private key material to the specified file path.

func (*AwsCloud) CreateEC2Instances

func (c *AwsCloud) CreateEC2Instances(prefix string, count int, amiID, instanceType, keyName, securityGroupID string, forMonitoring bool, iops, throughput int, volumeType types.VolumeType, volumeSize int) ([]string, error)

CreateEC2Instances creates EC2 instances

func (*AwsCloud) CreateEIP

func (c *AwsCloud) CreateEIP(prefix string) (string, string, error)

CreateEIP creates an Elastic IP address.

func (*AwsCloud) CreateSecurityGroup

func (c *AwsCloud) CreateSecurityGroup(groupName, description string) (string, error)

CreateSecurityGroup creates a security group

func (*AwsCloud) DeleteSecurityGroupRule added in v1.5.0

func (c *AwsCloud) DeleteSecurityGroupRule(groupID, direction, protocol, ip string, port int32) error

DeleteSecurityGroupRule removes a rule from the given security group

func (*AwsCloud) DestroyAWSNode added in v1.5.0

func (c *AwsCloud) DestroyAWSNode(nodeConfig models.NodeConfig, clusterName string) error

DestroyAWSNode terminates an EC2 instance with the given ID.

func (*AwsCloud) DestroyInstance added in v1.5.0

func (c *AwsCloud) DestroyInstance(instanceID, publicIP string, releasePublicIP bool) error

DestroyInstance terminates an EC2 instance with the given ID.

func (*AwsCloud) GetInstancePublicIPs

func (c *AwsCloud) GetInstancePublicIPs(nodeIDs []string) (map[string]string, error)

GetInstancePublicIPs returns a map from instance ID to public IP

func (*AwsCloud) GetInstanceTypeArch added in v1.5.0

func (c *AwsCloud) GetInstanceTypeArch(instanceType string) (string, error)

GetInstanceTypeArch returns the architecture of the given instance type.

func (*AwsCloud) GetRootVolumeID added in v1.5.2

func (c *AwsCloud) GetRootVolumeID(instanceID string) (string, error)

GetRootVolume returns a volume IDs attached to the given which is used as a root volume

func (*AwsCloud) GetUbuntuAMIID

func (c *AwsCloud) GetUbuntuAMIID(arch string, ubuntuVerLTS string) (string, error)

GetUbuntuAMIID returns the ID of the latest Ubuntu Amazon Machine Image (AMI).

func (*AwsCloud) IsInstanceTypeSupported added in v1.5.2

func (c *AwsCloud) IsInstanceTypeSupported(instanceType string) (bool, error)

IsInstanceTypeSupported checks if the given instance type is supported by the AWS cloud.

func (*AwsCloud) ListRegions added in v1.4.0

func (c *AwsCloud) ListRegions() ([]string, error)

ListRegions returns a list of all AWS regions.

func (*AwsCloud) ResizeVolume added in v1.5.2

func (c *AwsCloud) ResizeVolume(volumeID string, newSizeInGB int32) error

ResizeVolume resizes the given volume to the new size.

func (*AwsCloud) SetupSecurityGroup

func (c *AwsCloud) SetupSecurityGroup(ipAddress, securityGroupName string) (string, error)

SetupSecurityGroup sets up a security group for the AwsCloud instance.

func (*AwsCloud) UploadSSHIdentityKeyPair added in v1.3.7

func (c *AwsCloud) UploadSSHIdentityKeyPair(keyName string, identity string) error

UploadSSHIdentityKeyPair uploads a key pair from ssh-agent identity to the AWS cloud.

func (*AwsCloud) WaitForEC2Instances

func (c *AwsCloud) WaitForEC2Instances(nodeIDs []string, state types.InstanceStateName) error

WaitForEC2Instances waits for the EC2 instances to be running

func (*AwsCloud) WaitForVolumeModificationState added in v1.5.2

func (c *AwsCloud) WaitForVolumeModificationState(volumeID string, targetState string, timeout time.Duration) error

WaitForVolumeModificationState waits for the specified modification state of the volume.

Jump to

Keyboard shortcuts

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