awscloud

package
v0.0.0-...-5a776c5 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegionFromInstanceMetadata

func RegionFromInstanceMetadata() (string, error)

func SecureInstanceUserData

func SecureInstanceUserData(CloudWatchGroup string) string

SecureInstanceUserData returns the cloud-init user data for a secure instance.

func WaitUntilImportSnapshotTaskCompleted

func WaitUntilImportSnapshotTaskCompleted(c *ec2.EC2, input *ec2.DescribeImportSnapshotTasksInput) error

WaitUntilImportSnapshotCompleted uses the Amazon EC2 API operation DescribeImportSnapshots to wait for a condition to be met before returning. If the condition is not met within the max attempt window, an error will be returned.

func WaitUntilImportSnapshotTaskCompletedWithContext

func WaitUntilImportSnapshotTaskCompletedWithContext(c *ec2.EC2, ctx aws.Context, input *ec2.DescribeImportSnapshotTasksInput, opts ...request.WaiterOption) error

WaitUntilImportSnapshotCompletedWithContext is an extended version of WaitUntilImportSnapshotCompleted. With the support for passing in a context and options to configure the Waiter and the underlying request options.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

NOTE(mhayden): The MaxAttempts is set to zero here so that we will keep checking the status of the image import until it succeeds or fails. This process can take anywhere from 5 to 60+ minutes depending on how quickly AWS can import the snapshot.

Types

type AWS

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

func New

func New(region string, accessKeyID string, accessKey string, sessionToken string) (*AWS, error)

Initialize a new AWS object from individual bits. SessionToken is optional

func NewDefault

func NewDefault(region string) (*AWS, error)

Initialize a new AWS object from defaults. Looks for env variables, shared credential file, and EC2 Instance Roles.

func NewForEndpoint

func NewForEndpoint(endpoint, region, accessKeyID, accessKey, sessionToken, caBundle string, skipSSLVerification bool) (*AWS, error)

Initialize a new AWS object targeting a specific endpoint from individual bits. SessionToken is optional

func NewForEndpointFromFile

func NewForEndpointFromFile(filename, endpoint, region, caBundle string, skipSSLVerification bool) (*AWS, error)

Initializes a new AWS object targeting a specific endpoint with the credentials info found at filename's location. The credential files should match the AWS format, such as: [default] aws_access_key_id = secretString1 aws_secret_access_key = secretString2

If filename is empty the underlying function will look for the "AWS_SHARED_CREDENTIALS_FILE" env variable or will default to $HOME/.aws/credentials.

func NewFromFile

func NewFromFile(filename string, region string) (*AWS, error)

Initializes a new AWS object with the credentials info found at filename's location. The credential files should match the AWS format, such as: [default] aws_access_key_id = secretString1 aws_secret_access_key = secretString2

If filename is empty the underlying function will look for the "AWS_SHARED_CREDENTIALS_FILE" env variable or will default to $HOME/.aws/credentials.

func (*AWS) CopyImage

func (a *AWS) CopyImage(name, ami, sourceRegion string) (string, error)

target region is determined by the region configured in the aws session

func (*AWS) DescribeImagesByTag

func (a *AWS) DescribeImagesByTag(tagKey, tagValue string) ([]*ec2.Image, error)

For service maintenance images are discovered by the "Name:composer-api-*" tag filter. Currently all image names in the service are generated, so they're guaranteed to be unique as well. If users are ever allowed to name their images, an extra tag should be added.

func (*AWS) MarkS3ObjectAsPublic

func (a *AWS) MarkS3ObjectAsPublic(bucket, objectKey string) error

func (*AWS) Regions

func (a *AWS) Regions() ([]string, error)

func (*AWS) Register

func (a *AWS) Register(name, bucket, key string, shareWith []string, rpmArch string, bootMode *string) (*string, error)

Register is a function that imports a snapshot, waits for the snapshot to fully import, tags the snapshot, cleans up the image in S3, and registers an AMI in AWS. The caller can optionally specify the boot mode of the AMI. If the boot mode is not specified, then the instances launched from this AMI use the default boot mode value of the instance type.

func (*AWS) RemoveSnapshotAndDeregisterImage

func (a *AWS) RemoveSnapshotAndDeregisterImage(image *ec2.Image) error

func (*AWS) RunSecureInstance

func (a *AWS) RunSecureInstance(iamProfile, keyName, CloudWatchGroup string) (*SecureInstance, error)

Runs an instance with a security group that only allows traffic to the host. Will replace resources if they already exists.

func (*AWS) S3ObjectPresignedURL

func (a *AWS) S3ObjectPresignedURL(bucket, objectKey string) (string, error)

func (*AWS) ShareImage

func (a *AWS) ShareImage(ami string, userIds []string) error

func (*AWS) TerminateSecureInstance

func (a *AWS) TerminateSecureInstance(si *SecureInstance) error

func (*AWS) Upload

func (a *AWS) Upload(filename, bucket, key string) (*s3manager.UploadOutput, error)

type SecureInstance

type SecureInstance struct {
	FleetID  string
	SGID     string
	LTID     string
	Instance *ec2.Instance
}

Jump to

Keyboard shortcuts

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