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 profile switching #9

Closed
jamesls opened this issue Nov 5, 2015 · 7 comments
Closed

Support profile switching #9

jamesls opened this issue Nov 5, 2015 · 7 comments
Assignees
Milestone

Comments

@jamesls
Copy link
Member

jamesls commented Nov 5, 2015

I'd like a built in command that allows me to switch profiles. By switching to a different profile, server side autocomplete should be updated to work with the new profile.

@jamesls
Copy link
Member Author

jamesls commented Dec 3, 2015

Proposed interface:

The simplest thing I can think of is to use the . prefix and add another command, similar to .edit:

aws> .profile
default                  <--- prints the current profile
aws> .profile prod       <---- switches to prod profile.
aws> s3 ls               <---- now lists buckets in prod account

Thoughts?

@donnemartin
Copy link
Collaborator

use the . prefix

Sounds good to me.

Should we do something similar for region? BTW supporting profile and region switching is an often requested feature from saws, might be some ideas we can take from this discussion:

donnemartin/saws#16

Curious too if this should be 'sticky' or just for the current session.

@jamesls
Copy link
Member Author

jamesls commented Dec 4, 2015

.region would be useful, though that might get a little tricky with precedence. Should .region and .profile have equal precedence (which would be last one wins), or should .region have higher precedence?

Say I have:

[profile prod]
region=us-west-2

$ AWS_DEFAULT_REGION=us-west-1 aws-shell
aws> ec2 describe-instances    <-- us-west-1
aws> .region us-east-1
aws> ec2 describe-instances    <- us-east-1
aws> .profile prod             <-- say it's configured for us-west-2 in the CLI config file.
aws> ec2 describe-instances    <-- us-west-2 or us-west-1?

What about?

aws> .profile prod
aws> ec2 describe-instances
aws> .region us-west-1
aws> ec2 describe-instances    <-- us-west-2 or us-west-1?

@donnemartin
Copy link
Collaborator

Good question, I'm not sure which is preferred. I think either approach there might be some confusion from users thinking it should work the other way. Here's a saws ticket that is somewhat related so that users can quickly tell what profile (and maybe region) they are running:

donnemartin/saws#24

Saws also has the menu bar at the bottom which could list important info such as profile and region.

@benbridts
Copy link

I think it would be also great if you could specify the profile when starting aws-shell. Something like aws-shell --profile prod

@djhworld
Copy link

@ikben You can specify the profile by running AWS_PROFILE=prod aws-shell

@DanyC97
Copy link

DanyC97 commented Dec 17, 2015

i prefer the way @ikben said which is consistent with aws cli. I know you can set ENV variables but that imo is ugly ...
Once i'm in aws-shell i could take the benefit to use .profile rather than go out and then come back in...

@jamesls jamesls self-assigned this Dec 29, 2015
@jamesls jamesls added this to the 0.1.0 milestone Dec 29, 2015
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

5 participants