Home

Awesome

go-aws-session

This package is a thing wrapper around the AWS Go SDK to allow for creating sessions using DSN strings.

Example


import (
	"github.com/aaronland/go-aws-session"
)

func main() {
	str_dsn := "region=us-east-1 credentials=env:"
	sess, err := session.NewSessionWithDSN(str_dsn)

	// do something with sess or err here
}

DSN strings

The following properties are required in DSN strings:

Credentials

Credentials for AWS sessions are defined as string labels. They are:

LabelDescription
anon:Empty or anonymous credentials.
env:Read credentials from AWS defined environment variables.
iam:Assume AWS IAM credentials are in effect.
sts:{ARN}Assume the role defined by {ARN} using STS credentials.
{AWS_PROFILE_NAME}This this profile from the default AWS credentials location.
{AWS_CREDENTIALS_PATH}:{AWS_PROFILE_NAME}This this profile from a user-defined AWS credentials location.

For example:

s3:///bucket-name?region=us-east-1&credentials=iam:

Region

Any valid AWS region.

See also