Daniel Hiller

Geek, programmer, father
Git aliases continued
All posts
 

Backup S3 buckets

2018-03-19

aws s3 bash 

Another oneliner to backup all s3 buckets to local file storage:

for bucket_name in $(aws s3api list-buckets | jq -r '.Buckets[].Name' | grep -v 'access-logging'); do \
    aws s3 sync "s3://$bucket_name/" "$sync_dir/$bucket_name/"; \
done

The last one is only necessary if you have a bucket that you need to ignore which in my case is the bucket configured for access logging.


Git aliases continued
All posts
 

Creative Commons License This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. Last update on 2018-04-04. Built by dhiller using Atom (editor), Jekyll (site builder), OneDark vivid (syntax highlighting theme), Webjeda (related posts), Disqus (discussions), Github Pages (hosting), Cloudflare (DNS).