Closed jamesls closed 8 years ago
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?
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:
https://github.com/donnemartin/saws/issues/16
Curious too if this should be 'sticky' or just for the current session.
.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?
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:
https://github.com/donnemartin/saws/issues/24
Saws also has the menu bar at the bottom which could list important info such as profile and region.
I think it would be also great if you could specify the profile when starting aws-shell. Something like aws-shell --profile prod
@ikben You can specify the profile by running AWS_PROFILE=prod aws-shell
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...
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.