Skip to main content
Back to Journal
Amazon Web Services

Building a serverless website with S3

What is S3: Simple Storage Solution

Amazon S3 is a cloud based storage solution that gives its users the ability to have a highly-scalable, reliable, and low-latency data storage infrastructure at very low costs.

S3 Overview

Simple Storage Service: A safe place to store your files.

  • Object based storage: Users can store flat files like word documents, videos, photos, PDFs, etc.
  • Files can be from 0 bytes to 5TB in size with unlimited storage
  • Files stored in Buckets (Buckets are just Folders) that must be unique globally
  • Read after Write Consistency for new objects and Eventual Consistency for overwrites and deletes
  • Amazon offers 99.99% Availability and 99.99999999% Durability Guarantee

Running a Serverless Website

Static websites can run on S3 without a server. A static site displays fixed content in HTML to all visitors without writing to a backend or requiring database deployment.

Steps To Build

  1. Go to S3 inside AWS Services
  2. Create a new bucket with a globally unique name
  3. Set permissions to grant public read access
  4. Go to bucket properties and select static web hosting
  5. Enter the name of your index document (e.g., index.html)
  6. Enter the name of your error/404 page
  7. Upload all HTML, CSS, and JS files to the bucket
  8. Set permissions to grant public read access on upload
  9. Get your endpoint URL inside static web hosting properties
  10. Your static application is live!

AWS Lambda

AWS Lambda is an event-driven, serverless computing platform that runs code in response to events. You pay only for compute time consumed.

Conclusion

S3 offers an inexpensive way to deploy static websites. The setup requires only one AWS resource instead of multiple components like computing instances and security groups.

Amazon Web ServicesAWSS3Serverless