Skip to content

Instantly share code, notes, and snippets.

@alexrudd
Last active February 17, 2017 19:04
Show Gist options
  • Save alexrudd/fe439c26898e26845511133fa507bfdc to your computer and use it in GitHub Desktop.
Save alexrudd/fe439c26898e26845511133fa507bfdc to your computer and use it in GitHub Desktop.
Default AWS credentials chain
package main
import (
"fmt"
"github.com/aws/aws-sdk-go/aws/defaults"
)
func main() {
creds := defaults.CredChain(defaults.Config(), defaults.Handlers())
// Validate credentials
if _, err := creds.Get(); err != nil {
// We couldn't get any credentials
fmt.Println(err)
return
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment