AWS eb init not a valid key=value pair (missing equal-sign) - amazon-web-services

I was trying to set up a basic rails app and deploy it to Elastic Beanstalk. I ran eb init, picked my region and it asked for (aws-access-id): and (aws-secret-key):. For what ever reason it wasn't accepting my credentials and without realizing it at one point I had accidentally ran a command eb --version in the (aws-access-id): line. Now I can't get past choosing my region. I get
ERROR: ServiceError - '--version/20190924/us-west-2/elasticbeanstalk/aws4_request' not a valid key=value pair (missing equal-sign) in Authorization header: 'AWS4-HMAC-SHA256 Credential=eb --version/20190924/us-west-2/elasticbeanstalk/aws4_request, SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date, Signature=afc27125738fef1062fc8565e130ced6e0f7b2c343c2e28456d7693c8f396c92'.
I have been looking for a solution for countless hours now and can't find anything. I tried deleting .elasticbeanstalk file(some had mentioned), uninstalling it altogether, aws configure and put in the proper credentials, followed other stackoverflow questions. Nothing seems to work and the error will not go away. Tried looking up how to reset the headers. Not sure why this was saved in the first place. I feel it should have just given me wrong credentials if anything.
WS eb init missing equal-sign error
I am on a mac.

Okay, finally figured it out thanks to the link in my question to another similar stack overflow question. What I did was cd to my root directory where I finally did $ ls -a to see hidden files and saw .aws. I $ cd .aws and then ran $ open config. It open this
aws_access_key_id = eb --version
aws_secret_access_key = ENTER_SECRET_HERE
[default]
output = json
region = 3
Changed the key_id and access_key and it worked! Hope it helps out someone else before going insane.

in order to find the problem I used the cmd
eb init --verbose --debug
which included the output "...not a valid key=value pair (missing equal-sign) in Authorization header..."
I then googled that and was lead to your post. thanks!

Related

Google Cloud App: ERROR: (gcloud.app.deploy) INVALID_ARGUMENT: Any spaces must be in the middle of a filename:

I'm following the tutorial of how to deploy a new Google Cloud app to the tee.
I ran:
gcloud app deploy
I'm getting this error:
ERROR: (gcloud.app.deploy) INVALID_ARGUMENT: Any spaces must be in the middle of a filename: ~/envs/hello_world/bin/activate
What could have gone wrong?
I had a similar issue when doing the tutorial it turned out I was adding an extra space when executing this command:
$ virtualenv --python python3 \ ~/envs/hello_world
Instead of:
$ virtualenv --python python3 \~/envs/hello_world
And that was causing all the trouble. I also had to delete the hello_world directory and reclone it, then using the correct command (without the space) to get it working correctly.
I just had this issue myself. Drove me insane.
For me it was literally what it said - it doesn't like spaces on the beginning or end of files or folders. Follow the path that it reports in the error from your current directory, and find any folders or files with a space likely on the end. Get rid of it, all good.
It reported
INVALID_ARGUMENT: Any spaces must be in the middle of a filename: exec -l /bin/bash/google-cloud-sdk/lib/gcloud.py
and true enough, the "exec -l" folder was actually "exec -l ". You can even see that in the output on the error, I was just blind to it.
I assume you are following the Google App Engine Documentation for deploying you app. I have tested the documentation and the App was deployed successfully. It looks like you are trying to deploy the app from a virtual environment and either some of the files that used for deployment have an invalid name or some folders do. Names must contain only letters and _ .
Try moving the hello_world folder, that contains all your App files for deployment, to the main directory and check that all the filenames are formed correctly. Then, try deploying again.
The question has very few information, so if what I have suggested to you didn't help. Please provide more information about the issue.

Partial credentials found in env, missing: AWS_SECRET_ACCESS_KEY

Just configured the AWS CLI on my computer with my AWS Access and Secret Key. When I try to use the AWS CLI though it gives me this error.
Partial credentials found in env, missing: AWS_SECRET_ACCESS_KEY
I went to ~/.aws/config, and sure enough those credentials are there, including the AWS Secret Key, so I'm not sure why its squawking at me.
You should have this file ~/.aws/credentials
and the contents should be in the following format:
[default]
aws_access_key_id = XXXXXXXXXXXXXXXXXX
aws_secret_access_key = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
For anyone who is having the same problem - this is solution that worked for me:
If you are on Windows - check if you don't have AWS_ACCESS_KEY_ID set in your system variables. AWS CLI uses something called configuration provider chain - and environment variables take precedence over configuration file. In my case somehow I had only set AWS_ACCESS_KEY_ID thus the error message.
If you are using MacOS, this may be caused because you set other credentials in the environmental variables.
Setting the new credentials to the environmental variables might solve your problem.
To do so run this in the terminal:
export AWS_ACCESS_KEY_ID=X
export AWS_SECRET_ACCESS_KEY=Y
export AWS_DEFAULT_REGION=REGION
Substitute X, Y, and REGION with the values corresponding to your application.
Source documentation: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html
I ran with this problem and I did rerun the same workflow yml again and again but changes were never actually occurs. Finally, I had to remove existing workflow from GitHub and re-initiate/pushed yml configuration file again. Worked for me. Thank You!

AWS Elastic Beanstalk commands return no output

I am very new to the Amazon Web Services and have been trying a learn-by-doing approach with them.
In summary I was trying to set up Git with the elastic beanstalk command line interface for my web-app. However, I wanted to use my SSH key-pair to authenticate (aws-access-id, secret) and in my naivety and ignorance, I just supplied this information (the SSH key files) and now I can't get it to work. More specifically stated below.
I have my project directory with Git set up so that it works. I then open the git bash window MINGW64 (I am on Windows 10) and attempt to set up eb.
$ eb init
It then tells me that my credentials are not set up and asks me for aws-access-id and the secret. I had just set up the SSH key-pair and try to enter these files; what's the harm in trying? EB failure, it turns out. Now, the instances seem to run fine still, looking at their status on the AWS console website. However, whatever I type into the bash:
$ eb init
$ eb status
$ eb deploy
$
There is no output. Not even an error. It just silently returns to awaiting a new command from me.
When using the --debug option with these commands, a long list of operations is returned, ending with
botocore.parsers.ResponseParserError: Unable to parse response (no element found: line 1, column 0), invalid XML received:
b''
I thought I would be able to log out or something the like, so that I could enter proper credentials which I messed up from the beginning. I restarted the web-app from the AWS webpage interface and restarted my PC. No success.
Thanks in advance.
EDIT:
I also tried reinstalling awscli and awsebcli:
pip uninstall awsebcli
pip uninstall awscli
pip install awscli
pip install awsebcli --upgrade --user
Problem persists, but now there is one output (previously seen only upon --debug option):
$ eb init
ERROR: ResponseParserError - Unable to parse response (no element found: line 1, column 0), invalid XML received:
b''
$
It sounds like you have replaced your AWS credentials in ~/.aws/credentials and/or ~/.aws/config file(s) with your SSH key. You could manually replace these or execute aws configure if you have the AWS CLI installed.

AWS ElasticBeanstalk: JWT token not being validated after configuration change

Using AWS console, I changed configuration setting of api key for a third-party service. Then all of a sudden, the following error is popping up on my live server.
{"detail":"Authentication credentials were not provided."}
It seems JWT token is not being validated(or passed). After hours of googling, I found that the error is caused by EB apache setting
Apparently, by setting,
container_commands:
01_wsgipass:
command: 'echo "WSGIPassAuthorization On" >> ../wsgi.conf'
in *.config, the problem should go away. I did exactly the same, with the code in wgsi_enabled_pass.config created within .ebextensions but it is still not working.
Please help the newbie pros! Thanks in advance!
Add this to a .ebextensions/customize_httpd.config file:
files:
"/etc/httpd/conf.d/wsgi_custom.conf":
mode: "000644"
owner: root
group: root
content: |
WSGIPassAuthorization On
This is more reliable then trying to concat to a conf file that may or may not exist.
#nbeuchat
If I rememeber correctly, try restarting the app from EBS console, or re-deploy the codes AFTER setting the container_commands in *.config as in the question. If this does not fix the problem, let me know. I'll look into what I did in the past to fix the bug.

Error when using AWS-SDK-GO (NoCredentialProviders: no valid providers in chain)

I've recently started using the aws-sdk-go package.
Walking through the instructions, my folder structure is as follows:
bin/ , pkg/ (as always)
src/
app/main.go (code taken from the docs)
github.com/aws
Now when I run go install, and then execute the app.exe (using windows here), I'm getting the following error:
panic: NoCredentialProviders: no valid providers in chain
Any ideas?
You need to provide an AWS access key and secret key to authenticate and use AWS services.
See the README here https://github.com/aws/aws-sdk-go#configuring-credentials
If anyone runs into the same issue I had with this:
I read a doc that said to put the file at %USERPROFILE%.awscredentials on a Windows, but they just forgot the slash. It should be %USERPROFILE%.aws/credentials.
Double check the format of your ~/.aws/credential file.
In my case, the credentials used the following format :
[profile]
AWS_ACCESS_KEY_ID=xxxx
AWS_SECRET_ACCESS_KEY=yyyy
changing it to the following fixed the issue :
[profile]
aws_access_key_id = xxxx
aws_secret_access_key = yyyy