I have this function that should check for the credentials set under .aws/credentials
but its not working so i tried to add use some retry functions but its still not working, the credentials are set good because if i make the aws sts get-caller-identity
without running this function is working, what could be wrong with my code that the retry is not working?
ctx := context.TODO()
cfg, err := config.LoadDefaultConfig(ctx, config.WithRegion("eu-central-1"))
if err != nil {
log.Fatalf("failed to load configuration, %v", err)
}
client1 := sts.NewFromConfig(cfg)
customRetry := retry.NewStandard(func(o *retry.StandardOptions) {
o.MaxAttempts = 60
})
identity, err3 := client1.GetCallerIdentity(ctx, &sts.GetCallerIdentityInput{}, func(o *sts.Options) {
o.Retryer = customRetry
})
if err3 != nil {
log.Fatal(err3)
}
log.Printf("Account: %s, Arn: %s", aws.ToString(identity.Account), aws.ToString(identity.Arn))