Commit ea2f65b4 by Carl Bergquist Committed by GitHub

Merge pull request #10110 from bwhaley/master

Fixes bug in cloudwatch regarding credentials
parents 5d70a36a 51854ff4
...@@ -11,6 +11,7 @@ import ( ...@@ -11,6 +11,7 @@ import (
"github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds" "github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds"
"github.com/aws/aws-sdk-go/aws/credentials/endpointcreds" "github.com/aws/aws-sdk-go/aws/credentials/endpointcreds"
"github.com/aws/aws-sdk-go/aws/defaults"
"github.com/aws/aws-sdk-go/aws/ec2metadata" "github.com/aws/aws-sdk-go/aws/ec2metadata"
"github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/cloudwatch" "github.com/aws/aws-sdk-go/service/cloudwatch"
...@@ -128,10 +129,10 @@ func remoteCredProvider(sess *session.Session) credentials.Provider { ...@@ -128,10 +129,10 @@ func remoteCredProvider(sess *session.Session) credentials.Provider {
func ecsCredProvider(sess *session.Session, uri string) credentials.Provider { func ecsCredProvider(sess *session.Session, uri string) credentials.Provider {
const host = `169.254.170.2` const host = `169.254.170.2`
c := ec2metadata.New(sess) d := defaults.Get()
return endpointcreds.NewProviderClient( return endpointcreds.NewProviderClient(
c.Client.Config, *d.Config,
c.Client.Handlers, d.Handlers,
fmt.Sprintf("http://%s%s", host, uri), fmt.Sprintf("http://%s%s", host, uri),
func(p *endpointcreds.Provider) { p.ExpiryWindow = 5 * time.Minute }) func(p *endpointcreds.Provider) { p.ExpiryWindow = 5 * time.Minute })
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment