Skip to content

Commit

Permalink
WIP try explicitly enabling regional STS endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
johngmyers committed Jul 25, 2021
1 parent c461674 commit 54bd5cb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion upup/pkg/fi/cloudup/awsup/aws_authenticator.go
Expand Up @@ -25,6 +25,7 @@ import (

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/ec2metadata"
"github.com/aws/aws-sdk-go/aws/endpoints"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/sts"
"k8s.io/kops/upup/pkg/fi"
Expand Down Expand Up @@ -57,7 +58,10 @@ func RegionFromMetadata(ctx context.Context) (string, error) {
}

func NewAWSAuthenticator(region string) (fi.Authenticator, error) {
config := aws.NewConfig().WithCredentialsChainVerboseErrors(true).WithRegion(region)
config := aws.NewConfig().
WithCredentialsChainVerboseErrors(true).
WithRegion(region).
WithSTSRegionalEndpoint(endpoints.RegionalSTSEndpoint)
sess, err := session.NewSession(config)
if err != nil {
return nil, err
Expand Down
6 changes: 5 additions & 1 deletion upup/pkg/fi/cloudup/awsup/aws_verifier.go
Expand Up @@ -32,6 +32,7 @@ import (
"time"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/endpoints"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/aws/aws-sdk-go/service/sts"
Expand Down Expand Up @@ -60,7 +61,10 @@ type awsVerifier struct {
var _ fi.Verifier = &awsVerifier{}

func NewAWSVerifier(opt *AWSVerifierOptions) (fi.Verifier, error) {
config := aws.NewConfig().WithCredentialsChainVerboseErrors(true).WithRegion(opt.Region)
config := aws.NewConfig().
WithCredentialsChainVerboseErrors(true).
WithRegion(opt.Region).
WithSTSRegionalEndpoint(endpoints.RegionalSTSEndpoint)
sess, err := session.NewSession(config)
if err != nil {
return nil, err
Expand Down

0 comments on commit 54bd5cb

Please sign in to comment.