Skip to content

Commit

Permalink
Provide newly required initialization arguments aws/aws-sdk-go#452
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Compton committed Jan 23, 2016
1 parent 5833752 commit 3906740
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/cmd/s3kms/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds"
"github.com/aws/aws-sdk-go/aws/ec2metadata"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/codegangsta/cli"
Expand All @@ -20,10 +21,11 @@ const (
)

func getAWSConfig(c *cli.Context) *aws.Config {
defaultClient := ec2metadata.New(session.New(aws.NewConfig()))
creds := credentials.NewChainCredentials(
[]credentials.Provider{
&credentials.EnvProvider{},
&ec2rolecreds.EC2RoleProvider{ExpiryWindow: 5 * time.Minute},
&ec2rolecreds.EC2RoleProvider{ExpiryWindow: 5 * time.Minute, Client: defaultClient},
})
region := c.GlobalString("region")
return &aws.Config{Credentials: creds, Region: aws.String(region)}
Expand Down

0 comments on commit 3906740

Please sign in to comment.