internal/cloud: Allow aws creds from defaults
Defaults according to https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config: Defaults to a chain of credential providers to search for credentials in environment variables, shared credential file, and EC2 Instance Roles. If nothing is specified fall back to whatever instance role.
This commit is contained in:
parent
17e809b5f7
commit
c4ecbea510
2 changed files with 9 additions and 1 deletions
|
|
@ -57,6 +57,12 @@ func NewFromFile(filename string, region string) (*AWS, error) {
|
|||
return newAwsFromCreds(credentials.NewSharedCredentials(filename, "default"), region)
|
||||
}
|
||||
|
||||
// Initialize a new AWS object from defaults.
|
||||
// Looks for env variables, shared credential file, and EC2 Instance Roles.
|
||||
func NewDefault(region string) (*AWS, error) {
|
||||
return newAwsFromCreds(nil, region)
|
||||
}
|
||||
|
||||
func (a *AWS) Upload(filename, bucket, key string) (*s3manager.UploadOutput, error) {
|
||||
file, err := os.Open(filename)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue