Skip to content

Instantly share code, notes, and snippets.

@appleboy
Last active January 25, 2018 06:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save appleboy/13675272f43185c40f341059fafd17c6 to your computer and use it in GitHub Desktop.
Save appleboy/13675272f43185c40f341059fafd17c6 to your computer and use it in GitHub Desktop.
minio sdk with AWS iam Role
package main
import (
"log"
"github.com/minio/minio-go"
"github.com/minio/minio-go/pkg/credentials"
)
func main() {
iam := credentials.NewIAM("")
minioClient, err := minio.NewWithCredentials("s3.amazonaws.com", iam, true, "")
if err != nil {
log.Fatalln(err)
}
err = minioClient.MakeBucket("mtk.appleboy46", "ap-southeast-1")
if err != nil {
log.Fatalln(err)
return
}
log.Println("Successfully created mybucket.")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment