Skip to main content

AWS S3 Storage Summary

In a Nutshell
What will I learn?In this tutorial we will generate a simple S3 usage report that shows AWS S3 buckets with current storage usage.

What you'll need

Software & Services

Permissions & Access

AWS provide an existing ReadOnlyAccess IAM Policy that covers all of the permissions needed for this tutorial. You can simply attach this AWS provided IAM Policy to your existing IAM User, Group or Role

Attach Existing IAM Policy
Screenshot: Attach Existing IAM Policy


In each of the examples below we will take advantage of several of the environment variables that are loaded and set when we activate a set of credentials in AWSH

env | grep ^AWS_
AWS_SESSION_EXPIRATION=2022-11-28 16:05:01
AWS_ID_NAME=dummy-account/[email protected]

We will use these environment variables to generate useful report names. This tutorial also makes use of one of the built-in commands available in AWSH awsh report-s3-usage which allows us to generate report and print it to console.

Simple Format Report

  • Create a simple text summary report

    awsh report-s3-usage
  • Here is a sample output generated from the S3 usage report


Markdown Format Report

  • Get the data from the AWS API using AWSH

    awsh report-s3-usage -f pipe
  • The Markdown format report is plain text but can be converted into many other common formats (HTML, PDF, MS Word, etc). One of our favourite online converters is or the extensions available for Microsoft VS Code

HTML Format Report

  • Create an HTML header for our report

    cat > "${HOME}/workspace/${AWS_ACCOUNT_NUMBER}-AWS-S3-Summary.html" <<EOF
    <title>AWS S3 Usage Summary for A/C: ${AWS_ACCOUNT_NUMBER}</title>
    <h1>AWS S3 Usage Summary for A/C: ${AWS_ACCOUNT_NUMBER}</h1>
    This S3 report was generated using AWSH on $(date)
    for AWS Account ${AWS_ACCOUNT_NUMBER} with alias: ${AWS_ACCOUNT_ALIAS}

  • Get the data from the AWS API using AWSH

    awsh report-s3-usage -f html >> "${HOME}/workspace/${AWS_ACCOUNT_NUMBER}-AWS-S3-Summary.html"
  • Add the HTML page footer to make a valid HTML page

    echo "</div></body></html>" >> "${HOME}/workspace/${AWS_ACCOUNT_NUMBER}-AWS-S3-Summary.html"

Now that you've had a look around why not check out the full documentation here.

Want to find out more?

At Hestio, we have taken our experience with designing and building on cloud to codify these patterns and made them available as a low-code pattern library for AWS. Why spend time and effort on reinventing the wheel when it's already a solved problem? Would you start developing office productivity software in a world where Microsoft Office already exists?

If you'd like to find out about worX, our low-code patterns library for AWS you can read more here or get in touch today to schedule a demo.

If you'd like to find out more about the products and services Hestio has to offer, select one of the options below.