adamcrosby / sts-example

Example of using the Golang aws-sdk STS AssumeRole capability.
BSD 3-Clause "New" or "Revised" License
10 stars 4 forks source link

STS Example

This go code shows how to take an optional ARN and ExternalID contraint and assume a role via STS.

creds = stscreds.NewCredentials(sess, arn, func(p *stscreds.AssumeRoleProvider) {
  p.ExternalID = &externalID
})

The key here is to use the stscreds provider for aws.Config, rather than work with the sts package and service directly.