Skip to content

Commit f6c1835

Browse files
authored
fix profile and region arguments (#234)
1 parent bce9847 commit f6c1835

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

cmd/main.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ package main
1616
import (
1717
"context"
1818
"fmt"
19-
"github.com/aws/aws-sdk-go-v2/config"
2019
"log"
2120
"os"
2221
"os/signal"
@@ -31,6 +30,8 @@ import (
3130
"github.com/aws/amazon-ec2-instance-selector/v2/pkg/selector"
3231
"github.com/aws/amazon-ec2-instance-selector/v2/pkg/selector/outputs"
3332
"github.com/aws/amazon-ec2-instance-selector/v2/pkg/sorter"
33+
"github.com/aws/aws-sdk-go-v2/aws"
34+
"github.com/aws/aws-sdk-go-v2/config"
3435
ec2types "github.com/aws/aws-sdk-go-v2/service/ec2/types"
3536
tea "github.com/charmbracelet/bubbletea"
3637
"github.com/spf13/cobra"
@@ -247,7 +248,18 @@ Full docs can be found at github.com/aws/amazon-` + binName
247248
}
248249

249250
ctx := context.Background()
250-
cfg, err := config.LoadDefaultConfig(ctx)
251+
cfg, err := config.LoadDefaultConfig(ctx,
252+
config.WithSharedConfigProfile(
253+
aws.ToString(
254+
cli.StringMe(flags[profile]),
255+
),
256+
),
257+
config.WithRegion(
258+
aws.ToString(
259+
cli.StringMe(flags[region]),
260+
),
261+
),
262+
)
251263
if err != nil {
252264
fmt.Printf("Failed to load default AWS configuration: %s\n", err.Error())
253265
os.Exit(1)

0 commit comments

Comments
 (0)