Just Start Typing Text and Press Enter

Aug 29, 2019

How to Push / Put Files to an AWS Bucket using the S3 Command (s3cmd) on Linux & Mac

0 Comment | By

Now that we have our Amazon Web Service Bucket created we are on our way to doing some fun things with Amazon S3 Commands. In this blog entry we are going to begin with pushing files from our local desktops or from our servers up to our Amazon S3 Buckets. This process is pretty straight forward though I feel that many may not know how to do this.


Getting started:

1.) Begin with opening up the Linux or Mac Terminal and navigate to a directory where you may have an image. In my case I have one called jimmy_wichard.jpg that lives there.


2.) In the Linux terminal let’s go to your desktop by entering the following:

cd ~/Desktop


3.) If you are on a Mac you will open up your terminal and enter the following to get to your desktop:

cd /home/(enter your username)/Desktop/


4.) Once we are here it’s time to send jimmy_wichard.jpg into the ethos or also known as our Amazon s3 Bucket. 🙂 Begin by running the following command to get this file pushed up:

s3cmd put jimmy_wichard.jpg s3://my-test-bucket-20/jimmy_wichard.jpg

To explain the above command we are using the s3cmd with a PUT command of the file jimmy_wichard.jpg and sending it to your s3://BUCKET in this example mine is called: my-test-bucket-20 following a trailing slash with again the jimmy_wichard.jpg file. Putting this all together the command will proceed with pushing up the file to our Amazon s3 Bucket:

5.) Here is what it looks like in our Amazon s3 Bucket:

6.) If you don’t want to see the warning:

WARNING: Module python-magic is not available. Guessing MIME types based on file extensions.

We can solve this by installing the python-magic module for both Linux and Mac below:

Install python-magic on Linux:

sudo apt-get update && apt-get install python-magic

Install python-magic on Mac:

brew install libmagic


I understand that there is much more to do here. Along with quite a bit of s3cmd flags that we can leverage. But I don’t want to go there just yet. My intention was to make this entry as simple and as easy as possible in a private bucket. I will create other entries to elaborate on the pushing / putting certain files, excluding others, and getting a list of our files on the command line, but for now let’s keep things simple.

Leave A Comment