https://github.com/aaronland/go-aws-session
A thing wrapper around the AWS Go SDK to allow for creating sessions using DSN strings.
https://github.com/aaronland/go-aws-session
aws golang
Last synced: about 2 months ago
JSON representation
A thing wrapper around the AWS Go SDK to allow for creating sessions using DSN strings.
- Host: GitHub
- URL: https://github.com/aaronland/go-aws-session
- Owner: aaronland
- Created: 2019-06-24T14:33:29.000Z (about 7 years ago)
- Default Branch: main
- Last Pushed: 2023-06-05T19:30:31.000Z (about 3 years ago)
- Last Synced: 2025-03-01T09:29:15.732Z (over 1 year ago)
- Topics: aws, golang
- Language: Go
- Homepage:
- Size: 26.4 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# go-aws-session
This package is a thing wrapper around the [AWS Go SDK](https://docs.aws.amazon.com/sdk-for-go) 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:
| Label | Description |
| --- | --- |
| `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
* https://aws.amazon.com/blogs/security/a-new-and-standardized-way-to-manage-credentials-in-the-aws-sdks/
* https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html
* https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html
* https://docs.aws.amazon.com/sdk-for-go/api/aws/session/
* https://github.com/google/go-cloud/blob/master/aws/aws.go