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

Feature request: Follow AWS_DEFAULT_REGION standard environment variable #66

Open
HariSekhon opened this issue Jan 8, 2025 · 2 comments
Labels
question Question

Comments

@HariSekhon
Copy link

Use case

I use direnv heavily eg. HariSekhon/Environments to automatically configure my $AWS_DEFAULT_REGION among other environment variables to make all commands shorter and easier.

But eksup doesn't seem to follow the standard AWS environment variables so I have to specify the region explicitly.

It would be nice if eksup defaulted to following the standard AWS environment variables to improve UX slightly.

Solution/User Experience

So I have to specify --region eu-west-1 explicitly as an argument for eksup analyze to find the cluster.

Alternative solutions

No response

@HariSekhon HariSekhon added feature-request Request for a new feature triage labels Jan 8, 2025
@bryantbiggs
Copy link
Member

it does - it uses the AWS SDK for Rust which respects the standard AWS credential chain. perhaps https://github.com/HariSekhon/Environments is not loading this in the correct manner?

@bryantbiggs bryantbiggs added question Question and removed triage feature-request Request for a new feature labels Jan 8, 2025
@HariSekhon
Copy link
Author

HariSekhon commented Jan 8, 2025

Update: this is because the SDK is only supporting AWS_REGION while AWS CLIv2 documents using AWS_DEFAULT_REGION.

This is definitely set in the environment:

$ env | grep AWS_DEFAULT_REGION
AWS_DEFAULT_REGION=eu-west-1

This is used by AWS CLIv2 to set the right region.

When I run

$ eksup analyze --cluster $EKS_CLUSTER
  ERROR eksup::eks::resources: Cluster mycluster not found
    at eksup/src/eks/resources.rs:23

which implies it is not picking up the environment variable, but if I run this it finds it:

eksup analyze --cluster $EKS_CLUSTER --region $AWS_DEFAULT_REGION

If I repeat more explicitly:

$ export AWS_DEFAULT_REGION=eu-west-1

$ eksup analyze --cluster $EKS_CLUSTER 
  ERROR eksup::eks::resources: Cluster mycluster not found
    at eksup/src/eks/resources.rs:23

Perhaps it's using a variable other than the AWS_DEFAULT_REGION one documented here which I regularly use for AWS CLI?

https://docs.aws.amazon.com/cli/v1/userguide/cli-configure-envvars.html

Testing again, I think it doesn't support the above, but rather AWS_REGION, as this works:

$ AWS_REGION=eu-west-1 eksup analyze --cluster $EKS_CLUSTER 

I've updated my code to export both now.

Might be worth supporting both in your project too if possible?

Related discussion:

aws/aws-sdk-go#2103

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

No branches or pull requests

2 participants