awscommons

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package awscommons contains routines for interacting with AWS. Meant to provide high level interfaces used throughout various Gruntwork CLIs. NOTE: The routines in this package are adapted for aws-sdk-go-v2, not V1.

Index

Constants

View Source
const (
	DefaultRegion = "us-east-1"
)

Variables

This section is empty.

Functions

func GetAllEnabledRegions added in v0.10.2

func GetAllEnabledRegions(opts *Options) ([]string, error)

GetAllEnabledRegions will return the list of AWS regions (e.g., us-east-1) that are enabled and available to use in the account.

func GetSecretsManagerMetadata

func GetSecretsManagerMetadata(opts *Options, secretID string) (*secretsmanager.DescribeSecretOutput, error)

GetSecretsManagerMetadata returns the metadata of the Secrets Manager entry with the given ID.

func GetSecretsManagerSecretString

func GetSecretsManagerSecretString(opts *Options, arn string) (string, error)

GetSecretsManagerSecretString will return the secret value stored at the given Secrets Manager ARN.

func NewDefaultConfig

func NewDefaultConfig(opts *Options) (aws.Config, error)

NewDefaultConfig will retrieve a new authenticated AWS config using SDK default credentials. This config can be used to setup new AWS service clients.

func NewEC2Client added in v0.10.2

func NewEC2Client(opts *Options) (*ec2.Client, error)

NewEC2Client will return a new AWS SDK client for interacting with AWS EC2.

func NewS3Client added in v0.10.0

func NewS3Client(opts *Options) (*s3.Client, error)

NewS3Client will return a new AWS SDK client for interacting with AWS S3.

func NewSecretsManagerClient

func NewSecretsManagerClient(opts *Options) (*secretsmanager.Client, error)

NewSecretsManagerClient will return a new AWS SDK client for interacting with AWS Secrets Manager.

func SecretsManagerEntryExists

func SecretsManagerEntryExists(opts *Options, arn string) (bool, error)

SecretsManagerEntryExists returns whether or not the SecretsManager Entry with the given ARN exists. This will return an error if it exists, but is not accessible due to permission issues, or if there is an authentication issue.

func UploadObjectString added in v0.10.0

func UploadObjectString(opts *Options, bucket, key, contents string) error

UploadObjectString will upload the provided string to the given S3 bucket as an object under the specified key.

Types

type Options

type Options struct {
	Region string

	Context context.Context
}

Options represents all the parameters necessary for setting up authentication credentials with AWS.

func NewOptions

func NewOptions(region string) *Options

NewOptions will create a new aws.Options struct that provides reasonable defaults for unspecified values.

Jump to

Keyboard shortcuts

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