Skip to content

Instantly share code, notes, and snippets.

View ironmike-au's full-sized avatar

richo ironmike-au

View GitHub Profile
package main
import (
"fmt"
"math/rand"
"os"
"time"
tea "github.com/charmbracelet/bubbletea"
)
@ironmike-au
ironmike-au / upload.go
Created July 31, 2020 18:50
AWS Golang S3 SDK Upload Manager Example
func uploadFile(fileName string) error {
creds := credentials.NewStaticCredentials(os.Getenv("AWS_ACCESS_KEY_ID"), os.Getenv("AWS_SECRET_ACCESS_KEY"), "")
_, err := creds.Get()
if err != nil {
return fmt.Errorf("bad credentials: %s", err.Error())
}
cfg := aws.NewConfig().WithRegion("ap-southeast-2").WithCredentials(creds)
svc := s3.New(session.New(), cfg)
uploader := s3manager.NewUploaderWithClient(svc, func(u *s3manager.Uploader) {
// Define a strategy that will buffer 32 MiB in memory

Keybase proof

I hereby claim:

  • I am otakumike on github.
  • I am otakumike (https://keybase.io/otakumike) on keybase.
  • I have a public key whose fingerprint is F210 5989 4442 07FF 355F 2BDD 7EAF 119C 9350 4359

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am otakumike on github.
  • I am otakumike (https://keybase.io/otakumike) on keybase.
  • I have a public key ASC4me6ms3kS-CGSQm7M0hrn4dmusLqrOkWqAC_h8Vx4qwo

To claim this, I am signing this object: