Note to Self: Using AWS Client’s S3 Sync
Install AWS client library
This is pretty easy to do. If you use homebrew on a mac, open a terminal and type:
brew install awscli
I’m assuming that you can to
apt-get install awscli on Linux, as well.
Using the Key & Secret
[s3-static-upload] aws_access_key_id = [KEY STRING] aws_secret_access_key = [SECRET STRING]
Get the key and secret by
- logging into the AWS console
- going to IAM (or search if they have yet again restructured)
- as of this writing, it’s under IAM Resources, Users (link). Once you open users, you’ll see it. You might have to regenerate it.
Amazon says this.
Copying/Uploading to AWS S3
Command to upload it:
/usr/local/bin/aws s3 sync ~/path/to/files/to/upload s3://[YOUR BUCKET NAME] --delete --profile s3-static-upload
--delete keeps your directories clean. If you are mirroring a blog, and you “unpublish” a post, you need to have the static files deleted from the server, or else they will still be active and viewable by your site visitors.