S3LS(1p)

πŸ“¦
version 0.08 Β· 2 versions
  • 0.08 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.08 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’… s3ls β€” okay bestie, let's talk

So s3ls is a lil Perl script that lives in the User Contributed Perl Documentation corner of your man pages (S3LS(1p), if you're keeping track), and its whole personality is: list your S3 buckets and what's inside them. That's it. That's the job. And it eats. πŸ‘‘


✨ NAME ✨

s3ls β€” list S3 buckets and bucket contents. Short king of a command name. πŸͺ£


🌸 SYNOPSIS 🌸

s3ls [options]

s3ls [options] [ [ bucket | bucket/item ] ...]

And here's the options + env lineup, exactly as printed:

 Options:
   --access-key    AWS Access Key ID
   --secret-key    AWS Secret Access Key
   --long
 Environment:
   AWS_ACCESS_KEY_ID
   AWS_ACCESS_KEY_SECRET

πŸŽ€ OPTIONS πŸŽ€

  • --help β€” prints a lil brief help message and then dips. Bye! πŸ‘‹
  • --man β€” prints the manual page and exits. Meta. Love that for it.
  • --verbose β€” tells you what it's doing while it's doing it. Narrating its own life. Main character energy fr.
  • --access-key and --secret-key β€” these two are how you hand over your "AWS Access Key Identifiers" for the AWS account. --access-key is the "Access Key ID", and --secret-key is the "Secret Access Key". Basically they're the username and password for your AWS account, so keep them confidential, bestie. Do not be posting these in the group chat. πŸ™ˆ

The access keys MUST be specified β€” either through these command line parameters, or through the AWS_ACCESS_KEY_ID and AWS_ACCESS_KEY_SECRET environment variables. There is no third option, no vibes-only auth.

If you put them on the command line, that overrides the environment variables. Command line stays winning. πŸ’…

  • --secure β€” uses SSL/TLS HTTPS to talk to the AWS service instead of HTTP. Encryption. We love a secure queen. πŸ”’
  • --long β€” that's it. That's the whole description. It's giving mysterious. (The DESCRIPTION section spills the tea on what it actually does, keep reading.)

🌈 ENVIRONMENT VARIABLES 🌈

  • AWS_ACCESS_KEY_ID and AWS_ACCESS_KEY_SECRET β€” these carry your "AWS Access Key Identifiers" for the AWS account. AWS_ACCESS_KEY_ID holds the "Access Key ID", and AWS_ACCESS_KEY_SECRET holds the "Secret Access Key". Same deal as before: they're effectively the username and password to the AWS service, so keep them confidential. 🀫

The access keys MUST be specified β€” either via these environment variables, or via the --access-key and --secret-key command line parameters. One of the two, no skipping.

And if the command line parameters are set, they override these environment variables. Periodt.


🧚 CONFIGURATION FILE 🧚

Okay so this is lowkey iconic: the configuration options get read from the file ~/.s3-tools if it exists. πŸ‘€ The format is the same as the command line options, just one option per line. For example, the file could contain:

--access-key <AWS access key>
--secret-key <AWS secret key>
--secure

This example configuration file would specify the AWS access keys and that a secure connection using HTTPS should be used for all communications. Set it and forget it. πŸ’–


πŸ‘‘ DESCRIPTION πŸ‘‘

Lists the buckets owned by the user, or all the item keys in a given bucket, or attributes associated with a given item. Choose your adventure.

If no buckets or bucket/itemkey is specified on the command line, all the buckets owned by the user are listed.

If the --long option is specified, the creation date of each bucket is also output.

If a bucket name is specified on the command line, all the item keys in that bucket are listed.

If the --long option is specified, the ID and display string of the item owner, the creation date, the MD5, and the size of the item are also output.

If a bucket name and an item key, separated by a slash character, is specified on the command line, then the bucket name and the item key are output. This is useful to check that the item actually exists. Vibe check, but for objects. βœ…

If the --long option is specified, all the HTTP attributes of the item are also output. This will include Content-Length, Content-Type, ETag (which is the MD5 of the item contents), and Last-Modifed.

It may also include the HTTP attributes Content-Language, Expires, Cache-Control, Content-Disposition, and Content-Encoding.

It will also include any x-amz- metadata headers.


πŸ’€ BUGS πŸ’€

Report bugs to Mark Atwood mark@fallenpegasus.com.

Occasionally the S3 service will randomly fail for no externally apparent reason. When that happens, this tool should retry, with a delay and a backoff.

Access to the S3 service can be authenticated with a X.509 certificate, instead of via the "AWS Access Key Identifiers". This tool should support that.

It might be useful to be able to specify the "AWS Access Key Identifiers" in the user's "~/.netrc" file. This tool should support that.

Errors and warnings are very "Perl-ish", and can be confusing. 😭 (ngl, relatable)

Trying to access a bucket or item that does not exist or is not accessible by the user generates less than helpful error messages.

This tool does not efficiently handle listing huge buckets, as it downloads and parses the entire bucket listing, before it outputs anything. It's downloading the whole thing first, bestie. Everything. Before. Anything.

This tool does not take advantage of the prefix, delimiter, and hierarchy features of the AWS S3 key listing API.

Heads up: all of the above are known limitations the author is flagging β€” not secret features. Don't @ me.

πŸ¦‹ AUTHOR πŸ¦‹

Written by Mark Atwood mark@fallenpegasus.com.

Many thanks to Wotan LLC <http://wotanllc.com>, for supporting the development of these S3 tools.

Many thanks to the Amazon AWS engineers for developing S3.


⭐ SEE ALSO ⭐

These tools use the Net::Amazon:S3 Perl module.

The Amazon Simple Storage Service (S3) is documented at <http://aws.amazon.com/s3>.


And that's the whole page, gorgeous. This beauty shipped as perl v5.34.0 and its date stamp is 2022-06-16 β€” so go forth, list those buckets, and stay secret with your secret key. 🫢✨