The AWS S3 tools are modeled on the unix directory and file abstraction. An S3 bucket is like a unix directory, and an S3 key is like a unix file. The basic operations are: create and remove a bucket, put files into a bucket, get files from a bucket, and list the contents of a bucket.
These tools store an MD5 checksum of the data that comprises the S3 object in the objects metadata (user-md5).
The s3rsync command can be used to sync a local directory/s3 bucket with another local directory/s3 bucket, including the MD5 checksum of the data objects.
The s3snap tool creates a snapshot of a source bucket in a destination bucket. Since the AWS S3 copy tool does not always copy the source metadata, including the user MD5 checksum of the data, the s3snap-fixup tool is needed to update the destination objects with the user MD5 checksum.
Ubuntu 24.01 $ snap install aws-cli --classic
The python boto3 library is the interface to the Amazon Web Services. The library can be found at https://github.com/boto.
See the boto3 README.
Ubuntu 20.10: $ apt install python3-boto3
The makefile installs the tools in the user's bin directory ($HOME/bin).
$ make install
export AWS_ACCESS_KEY_ID=YOUR_ACCESS_KEY
export AWS_SECRET_ACCESS_KEY=YOUR_SECRET_ACCESS_KEY
export AWS_DEFAULT_REGION=YOUR_DEFAULT_REGION
$ s3ls
OR
$ aws s3 ls
$ s3mb s3://BUCKET
OR
$ aws s3 mb s3://BUCKET --region=YOUR_DEFAULT_REGION
$ s3ls -l s3://BUCKET
OR
$ aws s3 ls --recursive s3://BUCKET
Includes the creation date and time of the object, the object size, the MD5 checksum on the data, and the key name.
$ s3ls s3://BUCKET/KEY-PREFIX
$ s3ls -l s3://BUCKET | sort | tail
$ s3ls -l s3://BUCKET | gawk -M '{s+=$3}END{print s};
$ s3ls -l s3://BUCKET/KEY-PREFIX | gawk -M '{s+=$3}END{print s}'
$ s3put BUCKET KEY FILE
$ s3put -r BUCKET directory
$ s3get BUCKET KEY OUTFILE
$ s3get -r BUCKET directory
$ s3rm s3://BUCKET/KEY
OR
$ aws s3 rm s3://BUCKET/KEY
$ s3rsync LOCAL-SRC-PATH s3://BUCKET/DEST-PATH
s3rsync uses the object size and the user MD5 checksum to determine if the objects differ.
$ s3rsync s3://BUCKET/SRC-PATH LOCAL-DEST-PATH
$ aws s3 mb s3://NEW-BUCKET
$ s3snap s3://OLD-BUCKET s3://NEW-BUCKET
Snapshots may be useful as a backup.