Gather metadata about your S3 buckets

Overview

S3 Meta

Crates.io Build Status

This tool has been migrated into s3-utils, please use that crate for future updates.

A simple tool to gather data about an S3 bucket (or subsection thereof). Designed to be simple, and (sort-of) shell consumable. Metadata will be added as it becomes available, and S3 interaction is controlled by rusoto_s3.

Installation

You can install s3-meta from either this repository, or from Crates (once it's published):

# install from Cargo
$ cargo install s3-meta

# install the latest from GitHub
$ cargo install --git https://github.com/whitfin/s3-meta.git

Usage

Credentials can be configured by following the instructions on the AWS Documentation, although examples will use environment variables for the sake of clarity.

You can retrieve metadata about a bucket using the following form (making sure your region matches your bucket AWS region):

$ AWS_ACCESS_KEY_ID=MY_ACCESS_KEY_ID \
    AWS_SECRET_ACCESS_KEY=MY_SECRET_ACCESS_KEY \
    AWS_DEFAULT_REGION=us-west-2 \
    s3-meta my.bucket.name

If you want to retrieve metadata about a "subdirectory" of a bucket, you can provide a prefix using this format:

$ AWS_ACCESS_KEY_ID=MY_ACCESS_KEY_ID \
    AWS_SECRET_ACCESS_KEY=MY_SECRET_ACCESS_KEY \
    AWS_DEFAULT_REGION=us-west-2 \
    s3-meta my.bucket.name/my/directory/path

Don't forget to add a space to the start of your command if you're going to inline your credentials as above!

Output

Output is pretty straightforward, and follows a relatively simple format which is easily extensible, and hopefully convenient in shell pipelines. There may be changes made to this format to make it easier to consume (spaces placed to make splitting easier, unformatted numbers, etc).

Below is an example based on a real S3 bucket (although the file names have been tweaked :)):

[general]
total_time=7s
total_space=1.94TB
total_files=51,152

[file_size]
average_file_size=37.95MB
average_file_bytes=37949529
largest_file_size=1.82GB
largest_file_bytes=1818900684
largest_file_name=path/to/my_largest_file.txt.gz
smallest_file_size=54B
smallest_file_bytes=54
smallest_file_name=path/to/my_smallest_file.txt.gz
smallest_file_others=12

[extensions]
unique_extensions=1
most_frequent_extension=gz

[modification]
earliest_file_date=2016-06-11T17:36:57.000Z
earliest_file_name=path/to/my_earliest_file.txt.gz
earliest_file_others=3
latest_file_date=2017-01-01T00:03:19.000Z
latest_file_name=path/to/my_latest_file.txt.gz

This sample is based on the initial builds of s3-meta. Depending on when you come to this tool, there may be more (or less) included in the output above.

You might also like...
miette is a diagnostic library for Rust. It includes a series of traits/protocols that allow you to hook into its error reporting facilities, and even write your own error reports!
miette is a diagnostic library for Rust. It includes a series of traits/protocols that allow you to hook into its error reporting facilities, and even write your own error reports!

miette is a diagnostic library for Rust. It includes a series of traits/protocols that allow you to hook into its error reporting facilities, and even write your own error reports!

Awtomate your 🦀 microservices with awto

awto Awtomate your 🦀 microservices with awto What is awto? Awto treats your rust project as the source of truth for microservices, and generates data

Clean up the lines of files in your code repository

lineman Clean up the lines of files in your code repository NOTE: While lineman does have tests in place to ensure it operates in a specific way, I st

A service for helping your cat find other cats
A service for helping your cat find other cats

Check back later! Discord Self-hosting This is an open-source service! Feel free to host you own private instances. All we ask is you credit us and li

Helps positioning your tauri windows.

Tauri plugin positioner A plugin for tauri that helps positioning you windows at well known locations. Install Rust [dependencies] tauri-plugin-positi

Ditch your status bar for some snazzy desktop notifications.
Ditch your status bar for some snazzy desktop notifications.

citron Ditch your panel for some snazzy desktop notifications. citron is: a non-intrusive alternative to status bars. on-demand, i.e. does not run in

Licensebat - 🔐⛵ Effortless dependency compliance with your license policies

Licensebat All docs here are temporary. Thougths For the moment, it seems it makes sense to have all the collectors sharing the same trait. That doesn

Dr-dotnet - 🩺 One-click diagnosis of your dotnet applications. Works both locally or remotely as a web service

Dr-dotnet - 🩺 One-click diagnosis of your dotnet applications. Works both locally or remotely as a web service. Based on the lowest level dotnet profiling APIs and using the rust language 🦀 for a minimal runtime penalty.

*looks in your general direction*

mirror the distributed mirroring service you never wanted (but i delivered to you anyway) what a distributed channel mirroring service for multiple se

Comments
  • PermanentRedirect Error.

    PermanentRedirect Error.

    Hello I'm keep getting this error:

    <?xml version="1.0" encoding="UTF-8"?>
    <Error><Code>PermanentRedirect</Code><Message>The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.</Message><Bucket>s3.amazonaws.com</Bucket><Endpoint>s3.amazonaws.com</Endpoint><RequestId>0A6606701931F006</RequestId><HostId>sLAQDaPDRZL/XotOOaJce7vHbB5ys+NhZ+1uIVHeSVwZZLg5B4aMe0uiDJJ3IzgCGwTpm9tZfsM=</HostId></Error>
    Error: The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.
    

    My region settings are the same for cli and bucket location. And my aws s3 cli works without any warnings.

    Would you mind to get me some pointers where to look to solve this? Thank you!

    Your tool looks like awesome project! Thank you for sharing!

    opened by lfx 9
  • Feature: fail faster if AWS credentials can't be found

    Feature: fail faster if AWS credentials can't be found

    https://github.com/rusoto/rusoto/issues/1082 describes this scenario: AWS credentials aren't available locally which causes a 30 second delay before Rusoto reports a failure to find AWS credentials. The ticket also has code showing how to set the timeout for sourcing credentials to prevent that from being an issue.

    Making a change in this area lets s3-meta fail faster to let users know what the problem is sooner. 😄

    opened by matthewkmayer 5
  • Feature Request: Use ~/.aws/config for Default Region

    Feature Request: Use ~/.aws/config for Default Region

    The AWS CLI uses the file ~/.aws/config to set the default region and, if included, also the aws_access_key_id and aws_secret_access_key, allowing all variables to be set in a single file.

    Please add support for referencing this file to determine the default region and other variables.

    opened by eytanhanig 3
  • how to get s3 bucket location

    how to get s3 bucket location

    aws has the api to get the region from the bucket.

    aws s3api get-bucket-location --bucket <bucketname>
    

    can I get the region from the bucket using s3-meta?

    opened by infinite-Joy 0
Releases(v1.0.1)
Owner
Isaac Whitfield
Fan of all things automated. OSS when applicable. Author of Cachex for Elixir. Senior Software Engineer at Axway. Intelligence wanes without practice.
Isaac Whitfield
Twidge is a fresh approach to productivity. It integrates with your workflow and allows you to be your most productive self.

Twidge A productivity app which is an extension to your mind Twidge is a cross platform productivity app, powered by rust, tauri, prisma-client-rust T

Twidge 187 Jun 28, 2023
Simple timer for your terminal

consoleTimer Simple timer that allows you to initiate countdown from N seconds. Usage: consoletimer [time in seconds] consoletimer [time in minutes]m

Arthur 20 Apr 4, 2022
🌲 Open the current remote repository in your browser

gitweb Some of the flags and options are subject to change in the future. Ideas are welcome. Ideas are bulletproof (V). gitweb is a command line inter

Yoann Fleury 26 Dec 17, 2022
A nifty commandline tool to manage your workstation.

workstation It's a nifty commandline rust tool to make you sit slightly away from your screen by blacking out the screen if you come too close and loc

Amar Lakshya (desi_tux) 16 May 6, 2022
Keep your dependencies up-to-date

Deps.rs - Dependency status at a glance Deps.rs is a service that shows you at a glance if any of your dependencies are out of date or insecure. This

deps.rs 369 Jan 5, 2023
Cross-platform bookmarks manager for your shell

shellmark: bookmark manager for shell THIS IS AN EARLY ALPHA. It works for me, but requires better UX and more polish. shellmark is a cross-platform b

Artem Pyanykh 25 Nov 10, 2022
Czkawka is a simple, fast and easy to use app to remove unnecessary files from your computer.

Multi functional app to find duplicates, empty folders, similar images etc.

Rafał Mikrut 9.2k Jan 4, 2023
🦸‍♂️ Recast migrates your old extensions to AndroidX, making them compatible with the latest version of Kodular.

Recast Recast helps make your old extensions compatible with Kodular Creator version 1.5.0 or above. Prerequisites To use Recast, you need to have Jav

Shreyash Saitwal 13 Dec 28, 2022
Add nice user-facing diagnostics to your errors without being weird about it.

thisdiagnostic is a Rust library for adding rich diagnostic metadata to errors, for some really fancy and customizable error reporting!

Kat Marchán 14 Feb 2, 2022
Combine internet connections, increase your download speed

dispatch A SOCKS proxy that balances traffic between network interfaces. Should work on macOS, Windows, and Linux. Only tested on macOS for now. This

Alexandre Kirszenberg 90 Jan 7, 2023