add manual credentials

This commit is contained in:
schulze
2023-03-20 15:43:14 +01:00
parent 4103f10502
commit e31a66a59d
4 changed files with 6 additions and 5 deletions

View File

@ -10,9 +10,9 @@ import (
"github.com/aws/aws-sdk-go-v2/service/ec2"
"github.com/aws/aws-sdk-go-v2/service/ec2/types"
)
func New_config(region string) aws.Config {
func New_config(region string, credentials string) aws.Config {
// Create a new AWS config
cfg, err := config.LoadDefaultConfig(context.TODO(), config.WithRegion(region))
cfg, err := config.LoadDefaultConfig(context.TODO(), config.WithSharedConfigFiles([]string{credentials}), config.WithRegion(region))
if err != nil {
fmt.Println("Error creating config:", err)
fmt.Println("Configure Credentials in line with the documentation found here: https://aws.github.io/aws-sdk-go-v2/docs/configuring-sdk/#specifying-credentials")