So you just wrote a book, report, article, or some other type of document. Now, you probably want to link to it on your website. Maybe as a reward for people that join your newsletter. Or as the final step of a custom checkout flow on PayPal, Stripe, or Braintree. One of the first questions that pops to mind is: Where do you host it?
Option 1. Host it on your shared hosting service
Hosting your PDF file on your shared hosting account can become a problem if your file is large or if many users start to download your file (there goes your hosting providers’ unlimited traffic promise that they advertised so much in their retargeting campaigns J).
Option 2. Host it on a file storage service
You can upload it to your Dropbox account, create a shared link, and send people to it. Easy, right? Not if you want complete control over the way that users see and interact with your file. What I don’t like about this option is that users will see a pop-up window asking them to create an account on Dropbox. After they create an account, login to their existing account, or click on the grey ‘X’ button, they will also see a comment box next to your PDF file. [Note: You can disable comments on a Dropbox file. Here’s how to.]
Personally, I prefer to have complete control over the experience that interact with the websites I build. This removes excessive dependencies on external services. Why? Well, imagine that Dropbox, Box, pCloud, or whatever other provider I decide to use for hosting my file decides to change their policies for shared links. With that new policy, only registered users of my preferred service are able to download files. That’s now really what i wanted to do in the first place.
Option 3. Host it on Amazon Simple Storage Service (Amazon S3)
The third time’s the charm, they say. Having turned down two possible solutions to the ‘Where to host my PDF file for download?’ problem, we come to the third and best solution: Amazon S3 on AWS. Amazon S3 is a simple storage service for files on the Internet. Because they’ve achieved economy of scale, it also tends to be the cheapest option compared to alternatives like Microsoft Azure and Google Cloud Platform. At least in my personal and work experience.
Step 1. Go to aws.amazon.com and login with your Amazon account. If you don’t have an Amazon account, it’s about time you created one.
Step 2. Sign into the AWS Management Console, the dashboard that lets you manage all your AWS services from one place.
Step 3. From the ‘Services’ tab, open Storage > ‘S3’.
The S3 Management Console will open up. From there, you can create a bucket to host your file. If you’re curious to know more, read about Buckets on Amazon S3.
Step 4. In the S3 Management Console, click on the blue ‘Create bucket’ button:
Step 5. The ‘Create bucket’ window will open up. Enter a Bucket name and Region.
The Bucket name will show up on all the URLs of the files that you upload in that bucket. For example: https://s3.us-east-2.amazonaws.com/dimitar.co/file_name.pdf
The Region is where, geographically, you want your files to be hosted on Amazon’s servers. As a rule of thumb, host your files in the closest possible location to the majority of your user base. If my users are concentrated in the US East region, then I will select a US East server.
Step 6. Keep going through the ‘Create bucket’ window and finish setting up your Bucket. At this stage, you don’t need to make your Bucket public. Later, when you upload your PDF file, you will make the file itself public.
Here’s a screenshot of how I’ve set up my Bucket. Note that:
- I haven’t activated any additional services from the second step, ‘Set properties.’ Unless you want any of these particular features, neither do you need to.
- I haven’t changed any of the default permissions in the third step, ‘Set permissions.’ Again, no need to play around with the settings unless you decide that you need to.
Step 7. Now that you have created your Bucket, click on its name in the S3 Management Console — and the Bucket interface will show up. Click on the blue ‘Upload’ button to upload your PDF file.
Step 8. The ‘Upload’ window will pop up. Select your file and proceed to the ‘Set permissions’ step. Here, you want to set the ‘Grant public read access to this object(s)’ in the dropdown menu of ‘Manage public permissions’. This is the part that makes your file public and available for download.
Step 9. Continue through the process and upload your file. When you’re done, select the file from the console. The window below will pop up. It contains the URL that you need to provide to people who want access to your PDF file.
Congrats, you’re done! Now provide the link to your file.