Skip to content

Profile is not picked up properly using aws-shell #166

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

Open
seroandone opened this issue Jan 2, 2017 · 5 comments
Open

Profile is not picked up properly using aws-shell #166

seroandone opened this issue Jan 2, 2017 · 5 comments
Labels

Comments

@seroandone
Copy link

seroandone commented Jan 2, 2017

I have two profiles in my .aws folder.

> cat config
[office]
output = json
region = us-east-1

[profile personal]
output = json
region = us-east-1

When I login to aws-shell I provide the profile

> aws-shell -p personal

Below is the output of '.profile'

aws> .profile
Current shell profile: personal

When I did 'ec2 describe-instances' it list all ec2's under my 'office' profile instead of 'personal'.

  1. I got a long list of ec2's for the below.
aws> ec2 describe-instances
{......}
  1. While below is the output if I specify --profile for 'ec2 describe-instances' command.
aws> ec2 describe-instances --profile personal
{
    "Reservations": []
}

Since I set profile while entering aws-shell. I would expect both the above two cases (1 and 2) to return the same result i.e. the one returned by 2 (as it is correct). I would expect the same from 1 as well.

I am using aws-shell version (0.1.1)

@donnemartin
Copy link
Collaborator

Hi @seroandone, I'm not able to reproduce this issue on my system (macOS 10.12, Python 2.7.10) on a fresh install of aws-shell 0.1.1. Are you still seeing this issue and if so, consistently?

@seroandone
Copy link
Author

Thanks @donnemartin I think i got the problem. I was having AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY in my environment variables, so that took precedence over the profile I mentioned when i logged into aws-shell. Unfortunately some apps that I have needs this environment variables.

I would expect if i specifically provide -profile during login to aws-shell, I assumed it will use that instead of even the environment variable. Or at lease when i change to a profile while I am in the aws-shell. But this is ok if it is the way it is as well. So one must not have environment variable if they got to use the profile feature.

Thanks for looking into this.

@donnemartin
Copy link
Collaborator

If AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are taking precedence over the profile feature (I haven't had a chance to verify this yet), I can see how that could be confusing. I'm not sure if that's the intended behavior. Thanks for the additional information!

@rdrey
Copy link

rdrey commented May 3, 2017

Suggestion: This would have probably been easier to debug if .profile also output the currently selected access key

@markl-vesper
Copy link

I've just downloaded both awscli & aws-shell (Windows 10)

Profiles work fine in cli and I get correct json output from ec2 describe-hosts command after setting profile using set AWS_PROFILE=xxxxxxxxx

However when I start aws-shell and provide same profile name ie aws-shell -p xxxxxxxxx and run same command I am not authorised to perform the operation.

Same issue I think

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

No branches or pull requests

5 participants