-
Notifications
You must be signed in to change notification settings - Fork 652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ExpiryWindow and ExpiryWindowJitterFrac to CredentialsCache #946
Conversation
i'm having a super hard time, trying to get this to work, with this new change https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/credentials/stscreds#hdr-Assume_Role can you please share here an example of how to assume role with the service client? |
Hi @innovia, could you describe the issue are you facing? Our migration guide has an example on how to assume a role. Please take a look - https://aws.github.io/aws-sdk-go-v2/docs/migrating/#assumerole . |
@skmcgrail thanks for the link, I am using okta was and have different roles to assume per environment, I'm gonna try the link you referenced |
@skmcgrail I couldn't get it to work from the docs, they are very unclear... this code (which i found by digging into github open source codes) works but is undocumented if assumeRoleArn != "" {
stsClient := sts.Client(t)
creds := stscreds.NewAssumeRoleProvider(stsClient, assumeRoleArn)
awsConfig.Credentials = creds
}
client := ec2.NewFromConfig(awsConfig) but according to the doc this code should be used. but its unclear: if assumeRoleArn != "" {
stsClient := sts.Client(t)
creds := stscreds.NewAssumeRoleProvider(stsClient, assumeRoleArn)
value, crErr := creds.Retrieve(ctx)
if crErr != nil {
return nil, fmt.Errorf("error retrieving credentials from sts: %+v", crErr)
}
awsConfig.Credentials = value
} it's very confusing because if I check the type of
|
Refactors the credential providers to remove ExpiryWindow behavior to the CredentialsCache. Adds a ExpiryWindowJitterFrac capability to the CredentialsCache to support the addition of jitter the configured refresh window.
Fixes: #940