ec2helper

package
v1.1.11 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Client  *ec2.EC2
	Session *session.Session

	Ec2InstanceIps        []string
	Ec2InstancePrivateIps []string
	// contains filtered or unexported fields
}

Client ...

func NewEC2Client

func NewEC2Client(region string, tags map[string]string) *Client

NewEC2Client ... ctor region is the region of the bucket you want to access leave it blank to use AWS_REGION environment variable

func NewEC2ClientWithSession

func NewEC2ClientWithSession(sess *session.Session, tags map[string]string) *Client

NewEC2ClientWithSession ... ctor

func (*Client) CreateInstance

func (c *Client) CreateInstance(instanceName string,
	instanceType string,
	iamProfile string,
	imageID string,
	subnetId string,
	securityGroupIDs []string,
	userData string,
	keyName string,
	minCount int64,
	maxCount int64) (*ec2.Reservation, error)

CreateInstance creates an EC2 instance

func (*Client) CreateInstanceAndWaitUntilReady added in v1.1.6

func (c *Client) CreateInstanceAndWaitUntilReady(instanceName string,
	instanceType string,
	iamProfile string,
	imageID string,
	subnetId string,
	securityGroupIDs []string,
	spotPrice string,
	userData string,
	keyName string,
	minCount int64,
	maxCount int64) error

CreateInstanceAndWaitUntilReady creates a ec2 spot instance and waits until it is ready

func (*Client) CreateSpotInstance

func (c *Client) CreateSpotInstance(instanceName string, instanceType string, iamProfile string, imageID string, subnetId string, securityGroupIDs []string, spotPrice string, userData string, keyName string, instanceCount int64) (*ec2.RequestSpotInstancesOutput, error)

CreateSpotInstance creates a ec2 spot instance

func (*Client) CreateSpotInstanceAndWaitUntilReady added in v1.1.2

func (c *Client) CreateSpotInstanceAndWaitUntilReady(instanceName string, instanceType string, iamProfile string, imageID string, subnetId string, securityGroupIDs []string, spotPrice string, userData string, keyName string, instanceCount int64) error

CreateSpotInstanceAndWaitUntilReady creates a ec2 spot instance and waits until it is ready

func (*Client) TerminateAllEC2Instances added in v1.1.2

func (c *Client) TerminateAllEC2Instances() (*ec2.TerminateInstancesOutput, error)

TerminateAllEC2Instances terminate all running EC2 instances created by this client

func (*Client) TerminateAllEC2InstancesAndWait added in v1.1.2

func (c *Client) TerminateAllEC2InstancesAndWait() error

TerminateAllEC2InstancesAndWait terminate all running EC2 instances created by this client and wait until shutdown

Jump to

Keyboard shortcuts

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