Skip to content

Commit

Permalink
add region to ec2 instance
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamKobi committed Nov 5, 2021
1 parent a3ce75f commit 9dc598d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/provider/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,14 @@ func newEC2(opts *Options) (*ec2.EC2, error) {
return nil, err
}

if _, err := sess.Config.Credentials.Get(); err != nil {
_, err = sess.Config.Credentials.Get()
if err != nil {
if err := ssoLogin(opts); err != nil {
return nil, err
}
}

return ec2.New(sess), nil
return ec2.New(sess, aws.NewConfig().WithRegion(opts.Region)), nil
}

func ssoLogin(opts *Options) error {
Expand Down

0 comments on commit 9dc598d

Please sign in to comment.