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

Cannot find default region in AWS config file. #614

Closed
breisig opened this issue Nov 20, 2019 · 1 comment · Fixed by #620
Closed

Cannot find default region in AWS config file. #614

breisig opened this issue Nov 20, 2019 · 1 comment · Fixed by #620
Assignees
Labels
Status: Untriaged An issue that has yet to be triaged.

Comments

@breisig
Copy link

breisig commented Nov 20, 2019

Version:

Knife Version: Chef Infra Client: 15.5.15
knife-ec2 (1.0.16)

Scenario:

We have multiple AWS accounts and have it integrated it with chef. However, It seems the plugin cannot read the default AWS region for a specific profile. It's very annoying having to specify the default region on every command.

When I do..

knife ec2 server list --aws-profile mycompany

It returns an EMPTY result but if I do

knife ec2 server list --aws-profile mycompany --region ca-central-1

It returns everything as normal.

It's annoying having to specify a region and now have it read from the AWS config file. I was pretty sure this once worked a long time ago.

Steps to Reproduce:

cat ~/.chef/config.rb

knife[:aws_credential_file] = File.join(ENV['HOME'], "/.aws/credentials")
knife[:aws_config_file] = File.join(ENV['HOME'], "/.aws/config")

cat ~/.aws/credentials

[mycompany]
aws_access_key_id = 12345
aws_secret_access_key = 67890

[profile  mycompany]
aws_access_key_id = 12345
aws_secret_access_key = 67890

cat ~/.aws/config

[mycompany]
region = ca-central-1

[profile mycompany]
region = ca-central-1
@breisig breisig added the Status: Untriaged An issue that has yet to be triaged. label Nov 20, 2019
@breisig
Copy link
Author

breisig commented Nov 21, 2019

As a temporary workaround, I had to hardcode this in my knife config.rb until I switch profiles.

cat ~/.chef/config.rb

knife[:region] = "ca-central-1"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Untriaged An issue that has yet to be triaged.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants