Partial credentials found in env, missing: AWS_SECRET_ACCESS_KEY - amazon-web-services

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!

Related

How to reset or start from scratch aws cdk configrations?

I have recently start using aws cdk as a newbie. so i ran lot of commands that i had no idea about.
now i want to remove all settings like env variables i created or profiles and start from scratch. what should in un install to achieve that?
I'm not totally sure what you're trying to reset but here's a few suggestions that might help:
Remove Deployed CDK Stacks
cdk destroy stack_name
Note: You'll have to do this for every stack you've deployed. This can also be done through "CloudFormation" in the AWS dashboard in your browser.
Remove CLI Settings
As per https://docs.amazonaws.cn/en_us/cli/latest/userguide/cli-configure-files.html
To remove a setting, use an empty string as the value, or manually delete the setting in your config and credentials files in a text editor.
Example:
aws configure set cli_pager ""
Remove Profiles
Unsure if you can do this easily through the CLI but you can just manually remove them from your config files. There are only two config files and they can be found using https://docs.amazonaws.cn/en_us/cli/latest/userguide/cli-configure-profiles.html
~/.aws/credentials (Linux & Mac) or %USERPROFILE%.aws\credentials (Windows)
~/.aws/config (Linux & Mac) or %USERPROFILE%.aws\config (Windows)
If you need more specific help on how to undo something then please provide an example of what exactly you ran that you would like to undo.

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

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!

AWS Credentials folder location

I am trying to install the Amazon Web Services Python SDK. I cannot find the ~/.aws/credentials folder on my machine though.
This is the page I am using for reference: https://aws.amazon.com/developers/getting-started/python/
It says the location on Windows should be like: C:\Users\USER_NAME.aws\credentials
I've done pip installs for boto, boto3, and awscli. Is there something else I need to install to get a credentials folder?
According to the link you posted...
Create your credentials file at ~/.aws/credentials (C:\Users\USER_NAME.aws\credentials for Windows users) and save the following lines after replacing the underlined values with your own.
With the contents
[default]
aws_access_key_id = YOUR_ACCESS_KEY_ID
aws_secret_access_key = YOUR_SECRET_ACCESS_KEY
There's nothing you need to install, just create the file, and put that in. (obviously swapping out YOUR_ACCESS_KEY_ID for your actual access key, and YOUR_SECRET_ACCESS_KEY for your actual secret key ;) )

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

AWS No Environment found for EnvironmentName = 'name-env'

Why might I be seeing this error after I run git aws.push?
remote: error: Unable to deploy application version: No Environment found for EnvironmentName = 'reco-api-env'.
When I grep my flask app's directory for EnvironmentName, I see this:
./.elasticbeanstalk/config:6:EnvironmentName=name-env
./.git/AWSDevTools/aws/elastic_beanstalk_config.rb:36: :environment_name => "EnvironmentName",
I had similar symptoms when I manually updated default_region from us-west-2 to us-west-1. Reverting back fixed the issue.
I suspect you missed a step in the process. You need to use eb start before doing git aws.push.
I was using eb create to setup a new environment where the name differed from what I had started with in /.elasticbeanstalk/config.yml
Once I updated the environment reference to the one one I meant to target, eb commands started working as expected.
I had this issue too. For me, it was because I had outdated credentials in my ~/.aws/config file. Fixing that solved the problem.