2

I'm setting environmental variables for the AWS via cli. I installed the aws-cli bundle in zip. After setting AWS creds I run: eval $(aws ecr get-login-password --region eu-west-2)

from which I'm getting this output I don't understand:

eval: eyJwYXlsb2FkIjoiaXB2b.....: File name too long

Can anyone advise what's happening here ?

Edit:

then
    curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
    unzip awscliv2.zip
    sudo ./aws/install
    unzip awscli-bundle.zip
    ./awscli-bundle/install -b ~/bin/aws
    export PATH=~/bin:$PATH
    export AWS_ACCOUNT_ID=''
    export AWS_ACCESS_KEY_ID=''
    export AWS_SECRET_ACCESS_KEY=''
    eval $(aws ecr get-login-password --region eu-west-2)
    export TAG=$GITLAB_BRANCH
    export REPO=$AWS_ACCOUNT_ID.dkr.ecr.us-west-1.amazonaws.com

aws-cli version: aws-cli/2.1.19 Python/3.7.3 Linux/5.8.0-38-generic exe/x86_64.ubuntu.20 prompt/off

aws ecr get-login --region eu-west-2 --no-include-email supposed to work as an alternative which just gives out the "help" output.

wood
  • 75
  • 1
  • 7
  • why do you `eval` the result of `aws ecr get-login-password --region eu-west-2`? – luk2302 Jan 17 '21 at 17:54
  • 1
    By the way: you posted live credentials of your container registry, I edited them out for now and flagged for mod intervention to actually remove them from the edit history. – luk2302 Jan 17 '21 at 17:57
  • Because it should return True or False when checking my creds. – wood Jan 17 '21 at 17:58
  • You should (if anything) pipe the result of the ecr command into `docker login --username AWS --password-stdin pathToYourECR` – luk2302 Jan 17 '21 at 17:58
  • That is not close to anything this command does, it returns credentials and then you do something with those credentials, `eval` has no place in this. – luk2302 Jan 17 '21 at 17:59
  • @luk2302 I didn't mind including it because it wasn't full output hence useless. – wood Jan 17 '21 at 17:59
  • @luk2302 Well, I added a snippet I'm working with. The `eval` command used to work just fine. It's not working anymore and I need to find out what went wrong. – wood Jan 17 '21 at 18:12
  • I remember the `eval` command returned `Login Succeeded` in the past. Now it's returning the lengthy output ending "Filename too long". – wood Jan 17 '21 at 18:29
  • @wood from the error it seems like realted to bash command line input limit. This question [Bash command line and input limit](https://stackoverflow.com/a/19355351/2246345) has few configs you can check. Is this inside a container? – samtoddler Jan 17 '21 at 18:36
  • As I said: the result should be piped into docker login: https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecr/get-login-password.html – luk2302 Jan 17 '21 at 19:02

0 Answers0