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
Home/End Keys Do Not Work in Tmux
How to Insert a New Line in Linux Shell Script
X11/Xlib.H Not Found in Ubuntu
Managing User Configuration Files Across Multiple Computers
Convert Multipage PDF to a Single Image
How to Get "Requests Per Second" for Apache in Linux
Ubuntu: Using Curl to Download an Image
Preserving File Permissions for Samba Shares When File Is Edited
What Exactly Is Sudo Bang Bang
How to Count Number of Unique Values of a Field in a Tab-Delimited Text File
How to Speed Up Linux Kernel Compilation
How to Monitor Data on a Serial Port in Linux
Open Vim from Within a Bash Shell Script
What Is the Fastest Way to Find All the File with the Same Inode