Skip to main content

Getting credentials: exec: executable aws failed with exit code 255

· 2 min read

banner

Error: failed to create kubernetes rest client for read of resource: Get “https://xxxxxxx.gr7.us-east-1.eks.amazonaws.com/api?timeout=32s": getting credentials: exec: executable aws failed with exit code 255

Most Terraform users might have seen this 255 error. Suddenly, for some reason, Terraform will surprise us specifically in AWS.

Let’s break down exactly what’s happening:

The problem is mostly with Terraform; try using your local kubeconfig to connect to EKS.

What happened generally?

kubernetes/kubectl/helm provider execute aws eks get-token to get a short-lived authentication token, but it can’t get it due to a few reasons

No Kubernetes REST client could be created

  1. could be an issue on AWS credentials
  2. If CI/CD, credential env not set correctly/wrongly
  3. Your ~/.aws/config or ~/.aws/credentials is missing or invalid.

Let’s Troubleshoot

Try this in your shell:

aws eks get-token --cluster-name your-cluster-name

If this fails, you’ll get a clearer error.

In my case, it worked. Next, I did If you’re using profiles, set:

export_ AWS\_PROFILE=your-profile

export_ AWS_PROFILE=kubelancer-dev

which solved.

then try

terraform plan  
terraform apply

image


👉 Originally published on Medium: Read more