If you’ll allow me to be blunt, S3 - Simple Storage Service - is a way to host files online. It’s a lot more than that to a lot of people, but hey, we aren’t web developers!

Hosting files on S3

Step One: Go to the S3 Dashboard

Visit the S3 site and log in or create an account. You’ll be able to use your normal Amazon account (if you have one).

Step Two: Create a bucket

Files come in collections called buckets. Just think of them as directories!

To create a new bucket, click the Create Bucket button. Then fill in a name and click Create. You can also pick a location if you’d like the content to be faster for certain parts of the world (this is probably only important if you’re using S3 as a CDN).

Note: The name has to be unique across all buckets ever created. I like to prefix the bucket with the project I’m working on, then a hyphen and a description of what’s going to go in it.

Step Three: Upload your files

Now upload your files by dragging them into the background area. You could also click the Upload button. Click Upload once you’re done dragging in files.

No, we don’t need to click Next.

Step Four: Change permissions

By default, the public isn’t allowed to see your files. We could have changed permissions in that last step buuuuut S3 changes often enough that it’s better to learn to do it once you’re inside of the bucket.

It’s also a total pain.

S3 manages these sorts of things using a bucket policy. Our bucket policy is going to be, “share everything!”

First click Permissions and Bucket Policy.

Once you’re there, paste in the code below, changing YOURBUCKETID to the name of your bucket. This weird string is called an ARN, an Amazon Resource Name.

After you’re done editing, click Save.

{
  "Statement": [
    {
      "Action": [
        "s3:GetObject"
      ],
      "Effect": "Allow",
      "Resource": "arn:aws:s3:::YOURBUCKETID/*",
      "Principal": {
        "AWS": [
          "*"
        ]
      }
    }
  ]
}

Step Five: Get file URLs

To get links to your file, go back to the Overview tab.

Click a file, and then you’ll see the URL down at the bottom