Bash with Aws Cli - Unable to Locate Credentials

Bash with AWS CLI - unable to locate credentials

sudo will change the $HOME directory (and therefore ~) to /root, and remove most bash variables like AWS_CONFIG_FILE from the environment. Make sure you do everything with aws as root or as your user, dont mix.

Make sure you did sudo aws configure for example. And try

sudo bash -c 'AWS_CONFIG_FILE=/root/.aws/config aws s3 sync s3://backup-test-s3 /s3-backup/test'

You might prefer to remove all the sudo from inside the script, and just sudo the script itself.

AWS Command Line Interface Unable to Locate Credentials - Special Permissions

Okay, so the config file cannot be a text file (.txt). You should create the file in CMD, and it should be a generic file w/o any extension.

Jenkins can't use aws-cli key. Unable to locate credentials for AWS CLI

Note: Not sure if it is recommended, but this worked for me:

sudo -su jenkins
cd /var/lib/jenkins/
mkdir .aws

then create credentials and config files.

then if you do aws configure list, it doesn't actually show the profiles added but it works while running the junkins job.

Windows AWS CLI Unable to locate credentials when running as System Account

The issue was a proxy was configured for system account thus couldn't get to local EC2 metadata URL.

It was quite hard to find as was hidden in registry on windows box. I had to open regedit as system account and go to IE and found it there. Just removed that key and worked fine.

Unable to locate credentials when trying to copy files from s3-bucket to my ec2-instance

Your AWS credentials on your local machine can't be seen by the awscli program on your EC2 instance. If you want to run the S3 copy command on the EC2 instance, you have two options:

1) Run aws configure on the EC2 instance and define the credentials on that machine (not recommended)

or

2) Create an IAM role with the required permissions to copy the files (for example, with the AmazonS3ReadOnlyAccess policy) and attach the role to your EC2 instance

While using Travis, why do I get unable to locate credentials in after_deploy

I believe this is because your S3 upload you are providing the access keys but those are specific to that operation. You need to setup your credentials so they can be used by the AWS CLI commands in your after_deploy. Try this in your after_deploy:

after_deploy:
- aws configure set aws_access_key_id $AWS_ACCESS_ID
- aws configure set aws_secret_access_key $AWS_SECRET_ID
- aws configure set preview.cloudfront true
- aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths "/*"


Related Topics



Leave a reply



Submit