Im writing a Bash script to download some objects from S3. The user account that runs this script does not have a home directory available. meaning - the folder refered to by $HOME does not exist.
I have used environment variables to redirect the credentials and config files. This is working, the files are created in the new location
export AWS_CONFIG_FILE=/newfolder/.aws/config
export AWS_SHARED_CREDENTIALS_FILE=/newfolder/.aws/credentials
I get a Permission denied error when running this command.
/usr/local/bin/aws --profile thisprofile s3 ls $BUCKET$FOLDER --recursive
It is trying to write to a cache file in the users home directory, but cannot because the $HOME directory doesn't exist.
$HOME/.aws/cli/cache/a5e04d49e9fc210124ee0431e237dccc5ed84794.json
I have tried to export HOME to a valid folder. This works but I don't think this is the nicest way to solve this. This script works properly with a user account that has a home directory.
Assuming I cannot just fix the missing home directory, Is there a way to redirect this cache file, or everything in .aws, to a new location similar to what I did with the credentials?
Edit: In addition to Anon Cowards answer showing where it explicitly calls the HOME variable, there is an open feature-request to disable caching