Skip to content

Instantly share code, notes, and snippets.

@SamuelBagattin
Created April 4, 2022 17:26
Show Gist options
  • Save SamuelBagattin/6a3f66f7e60f39d8e7b40001da317850 to your computer and use it in GitHub Desktop.
Save SamuelBagattin/6a3f66f7e60f39d8e7b40001da317850 to your computer and use it in GitHub Desktop.
// Session creation
sess := session.Must(session.NewSession())
// Create a new STS client to get temporary credentials
initStsClient := sts.New(sess)
// Get the SA token
awsWebIdentityTokenFile := os.Getenv("AWS_WEB_IDENTITY_TOKEN_FILE")
awsWebIdentityToken, err := ioutil.ReadFile(awsWebIdentityTokenFile)
if err != nil {
panic(err)
}
// Get the IAM role ARN
awsRoleArn := os.Getenv("AWS_ROLE_ARN")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment