Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for --region and --profile #16

Open
pnewb opened this issue Sep 21, 2015 · 11 comments
Open

Support for --region and --profile #16

pnewb opened this issue Sep 21, 2015 · 11 comments

Comments

@pnewb
Copy link

pnewb commented Sep 21, 2015

The AWS config file allows for multiple profiles and specifying a particular region if you're in more than one. This allows for having a single configuration file which holds credentials for multiple AWS accounts.

As I've got the [default] entry disabled by default, saws wouldn't function properly. At the moment I've set a particular profile and region as a default just to play around, and it looks pretty nice, but being able to specify profile and region when launching saws would be hugely helpful. (Alternately, if the functionality exists, and I just couldn't figure it out...my apologies.)

@mattford63
Copy link

I'd love to see this support also. You can split the profile into .aws/credentials and .aws/config allowing people in a company with very many accounts to share the config but not the credentials.

@donnemartin
Copy link
Owner

Great suggestion! Currently you'd have to specify region or profile like the following:

being able to specify profile and region when launching saws would be hugely helpful.

I agree, I think supporting a config for region and profile in ~/.sawsrc would do the trick.

@pnewb
Copy link
Author

pnewb commented Sep 22, 2015

What first came to my mind was more of:
saws --profile development --region us-west-2
and then all further commands would append those by default.

As mattford63 mentioned, you can have the profiles (along with default regions per profile making the --region flag truly optional) in ~/.aws/config where many other tools expect them. You'd be falling closer in line with existing convention, at least in my limited experience.

@donnemartin
Copy link
Owner

saws --profile development --region us-west-2

Thanks for clarifying!

@bashtoni
Copy link

You can also set the environment variable AWS_DEFAULT_PROFILE, meaning you no longer have to specify the profile for every command.

@djhworld
Copy link

I found this works

AWS_PROFILE=myprofile saws

@donnemartin
Copy link
Owner

Thanks for sharing @bashtoni and @djhworld.

@donnemartin
Copy link
Owner

In the meantime, I'll update the README installation section:

AWS Credentials and Named Profiles

Configure your credentials with the AWS CLI:

$ aws configure

If you'd like to use a specific named profile with SAWS, run the following commands on OS X, Linux, or Unix:

$ export AWS_DEFAULT_PROFILE=user1
$ saws

Or as a one-liner:

$ AWS_DEFAULT_PROFILE=user1 saws

Windows users can run the following commands:

> set AWS_DEFAULT_PROFILE=user1
> saws

Command line options for starting SAWS with a specific profile are under development.

For more details on how to install and configure the AWS CLI, refer to the following documentation.

@DanyC97
Copy link

DanyC97 commented Nov 21, 2015

+1

@jamesalbert
Copy link

I'm using 0.4.3, have my region set in an environment variable and profile, and while it's using the correct version it still says You must specify a region. You can also configure your region by running "aws configure". every time I refresh with F5. Not sure if it's a big deal, but it should reflect that my region is set. Everything else I'm using is picking it up, maybe I'm missing something?

@ozbillwang
Copy link

ozbillwang commented Aug 17, 2019

@donnemartin

Could we have the feature as

saws --profile development --region us-west-2

more than export the aws profile?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants