@@ -15,7 +15,6 @@ import (
1515
1616var (
1717 usePublicIP bool
18- region string
1918 appConfig * config.Config
2019)
2120
@@ -50,12 +49,12 @@ func MakeRoot() *cobra.Command {
5049 command .Run = runSSHAccess
5150
5251 command .Flags ().BoolVarP (& appConfig .Debug , "debug" , "d" , appConfig .Debug , "Enabled debug mode" )
52+ command .Flags ().StringVar (& appConfig .Region , "region" , appConfig .Region , "Default AWS region to be used. Either set AWS_REGION or AWS_DEFAULT_REGION" )
5353 command .Flags ().StringVarP (& appConfig .Tags , "tags" , "t" , appConfig .Tags , "EC2 tags key-value pair" )
5454 command .Flags ().StringVarP (& appConfig .SSHUsername , "ssh-username" , "u" , appConfig .SSHUsername , "EC2 SSH username" )
5555 command .Flags ().StringVarP (& appConfig .SSHPort , "ssh-port" , "p" , appConfig .SSHPort , "An EC2 instance ssh port" )
5656 command .Flags ().StringVarP (& appConfig .SSHOpts , "ssh-opts" , "o" , appConfig .SSHOpts , "An additional ssh options" )
5757 command .Flags ().BoolVarP (& usePublicIP , "use-public-ip" , "" , false , "Use public IP to access the EC2 instance" )
58- command .Flags ().StringVarP (& region , "region" , "" , "" , "Default AWS region to be used. Either set AWS_REGION or AWS_DEFAULT_REGION" )
5958
6059 return command
6160}
@@ -81,7 +80,7 @@ func runSSHAccess(cmd *cobra.Command, args []string) {
8180
8281 var target * aws.EC2Instance
8382
84- session := aws .NewSession (region )
83+ session := aws .NewSession (appConfig . Region )
8584
8685 if len (args ) > 0 {
8786 instances , err := aws .GetInstanceWithID (session , args [0 ])
0 commit comments