/awssession

Simple library to provide an AWS session in go

Primary LanguageGoMIT LicenseMIT

awssession - Super simple AWS session generator.

Go Report Card Coverage Status go.dev reference

Example

Simple example of an S3 Get.

package main

import (
    "github.com/aws/aws-sdk-go/aws"
    "github.com/aws/aws-sdk-go/service/s3"
    "github.com/aws/aws-sdk-go/service/s3/s3manager"
    "github.com/clok/awssession"
    "os"
)

func main() {
    var dstFile *os.File
    dstFile, _ = os.Create(dest)
    
    defer dstFile.Close()

    sess, _ := awssession.New()
    downloader := s3manager.NewDownloader(sess)
    
    _, _ = downloader.Download(dstFile, &s3.GetObjectInput{
        Bucket: aws.String("s3://aBucket"),
        Key:    aws.String("an/object.json"),
    })

    return
}

Development

  1. Fork the clok/awssession repo
  2. Use go >= 1.16
  3. Branch & Code
  4. Run linters šŸ§¹ golangci-lint run
  5. Commit with a Conventional Commit
  6. Open a PR