Question

I'm using boto-rsync for synchronizing files between my local server and Amazon S3. I'm also using it with Dreamhost's DreamObjects. Currently, I'm either using symbolic links to point the script to the appropriate credentials or I'm simply adding them into the script with --access-key KEY and --secret-key SECRET in order to deal with the different endpoints.

My bash script can destroy/create the link as needed, but that seems a little messy. And if I put the key and secret into the script they become exposed in the process list, which is not a big deal since I'm the only one on my server, but not really optimal, either.

Does anyone have a better idea?

* So my script now looks like this:

#!/bin/bash
i=bucketname
date
echo "***** syncing media to Amazon S3 *****"
export AWS_ACCESS_KEY_ID=s3-access-key
export AWS_SECRET_ACCESS_KEY=s3-secret-access-key
/usr/local/bin/boto-rsync /media/$i/ s3://$i/
date
echo "***** syncing media to DreamObjects *****"
export AWS_ACCESS_KEY_ID=dreamobjects-access-key
export AWS_SECRET_ACCESS_KEY=dreamobjects-secret-access-key
/usr/local/bin/boto-rsync --endpoint objects.dreamhost.com /media/$i/ s3://$i/
echo "***** finished syncing files *****"
date
exit 0

Not exactly what garnaat recommended, but inspired by his advice I read the boto docs https://github.com/boto/boto and discovered I could set environment variables. Much neater. Thanks!

Was it helpful?

Solution

I don't know a lot about boto-rsync but I know it uses boto under the hood and boto supports a BOTO_CONFIG environment variable that can be used to point to your boto configuration file. So, you could have two config files, one with your AWS credentials and one with your Dreamhost credentials and then set the BOTO_CONFIG environment variable to point to the appropriate config file when starting up.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top