Skip to content

Commit 12d3a7f

Browse files
committed
add option to specify a shell when using ssm session
1 parent 43501cc commit 12d3a7f

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

internal/ssm/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
type Session struct {
88
Profile string `short:"p" long:"profile" env:"AWS_PROFILE" default:"default" description:"What profile to use"`
99
Region string `short:"r" long:"region" env:"AWS_REGION" description:"What region to use, if not specified defaults to $AWS_DEFAULT_REGION or us-east-1"`
10+
Shell string `short:"s" long:"shell" default:"bash" description:"What shell to use on the remote instance"`
1011
}
1112

1213
type PortForward struct {

internal/ssm/session.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,13 @@ func (p *Session) DoSsm(ctx context.Context, id string) error {
2929
return err
3030
}
3131

32-
input := &awsssm.StartSessionInput{Target: &id}
32+
input := &awsssm.StartSessionInput{
33+
Target: &id,
34+
DocumentName: aws.String("AWS-StartInteractiveCommand"),
35+
Parameters: map[string][]string{
36+
"command": []string{p.Shell},
37+
},
38+
}
3339
inputJson, err := json.Marshal(input)
3440

3541
ssmclient := awsssm.NewFromConfig(cfg)

0 commit comments

Comments
 (0)