Connecting your macOS to AmazonS3 storage buckets.
This process requires a couple of Unix tools installed, s3cmd and gpg (optional), s3cmd is the command line tool used to connect to Amazon S3 and gpg is an optional secure tool allowing data transfer to be encrypted over HTTPS between you and Amazon.
This guide uses Homebrew to install the 2 required programs, so make sure you have that up and running first.
You will already need to have your Amazon S3 buckets set up and need to have Access ID and Secret Key ready to be pasted into the Terminal.
brew install s3cmd
brew install gpg
When prompted paste in your Access key, Secret key and encryption password, the encryption password has to be made by you. There are also some further fields that need to be validated or populated.
New settings: Access Key: XXX Secret Key: XXX Default Region: Asia Pacific S3 Endpoint: s3.amazonaws.com DNS-style bucket+hostname:port template for accessing a bucket: %(bucket)s.s3.amazonaws.com Encryption password: XXX Path to GPG program: /usr/local/bin/gpg Use HTTPS protocol: True HTTP Proxy server name: HTTP Proxy server port: 0
The path to gpg is:
Enter all the fields and the connection will be validated and saved for further connections. If it fails validation just run the command again and check you have the correct values.
Using the s3cmd Tool
To list all your buckets:
To list contents of a bucket:
s3cmd ls s3://mybucket
To get something from the bucket and move to your desktop:
s3cmd get s3://mybucket/my-needed-file.png ~/Desktop
And the reverse to put something to the bucket – using the –P flag to make it public:
s3cmd -P put ~/Desktop/my-file.png s3://mybucket/
To delete a file:
s3cmd del s3://mybucket/my-file-to-delete.png
Check the man for more options