« Back to Index

Shell: AWS S3 CLI - Logs

View original Gist on GitHub

Tags: #aws #shell #logs

AWS S3 CLI - Logs.sh

# List files in bucket...
aws s3 ls bf-logs-archive/

# Download file from bucket and decode it...
aws s3 cp "s3://bf-logs-archive/2017-08-02T08:00:00.000-w7QBJbe2XZtUy5oAAAAA.log.gz" fastly_logs/ # trailing slash is important! otherwise is copied as filename in current directory
gzip -d fastly_logs/2017-08-02T08\:00\:00.000-w7QBJbe2XZtUy5oAAAAA.log.gz

# http://docs.aws.amazon.com/cli/latest/reference/s3/
#
# Recursively copy only the things you want...
# --recursive --exclude "*" --include "things_you_want"