Skip to content

Instantly share code, notes, and snippets.

@do-me
Last active July 6, 2026 08:57
Show Gist options
  • Select an option

  • Save do-me/c73472befaf1cbe808136e2a4a3c0ed4 to your computer and use it in GitHub Desktop.

Select an option

Save do-me/c73472befaf1cbe808136e2a4a3c0ed4 to your computer and use it in GitHub Desktop.
Useful aws s3 commands
# clone folder from s3 to local recursively
aws s3 cp s3://some_folder ./some_folder/ --recursive
# get recursive size of folder on s3, human readable
aws s3 ls s3://some_folder/ \
--recursive --summarize |
awk '
/Total Objects/ {print}
/Total Size/ {
size=$3
split("B KiB MiB GiB TiB PiB", u)
i=1
while (size>=1024 && i<6) { size/=1024; i++ }
printf " Total Size: %.2f %s\n", size, u[i]
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment