A static website is a website that does not change its content and/or generate new data based on interactions with the user.
Static websites are great for displaying content that you'd like to stay the same, regardless for who views it. Examples include online portfolios, an announcement page for volunteers, or a personal blog.
Remember that “static” doesn't mean that our website can never change -- we can make as many updates and changes as we want. However, we'll be limited to making these changes through AWS directly.
How do we host a static website through AWS?
The first option is to host the website entirely through S3.
- In your S3 Bucket, enable “static website hosting”
- Set your index document (the default page for your users)
- Set the Bucket to be publicly readable
- Use the S3 website endpoint to access the page
The main limitations of hosting a static website purely through S3 are that it's slow, we can't use a custom domain name, and we have less access to security features.
The second option is to host the website using S3, CloudFront, ACM, and Route 53. The following is a highly simplified explanation of how these products interact:
- S3 holds our website's data in a bucket -- named, for example,
my-website/-- and we've configured it for public access - Cloudfront retrieves your S3 bucket and makes copies that it stores in worldwide edge servers
- Amazon Certificate Manager (ACM) provides our website with certificates, enabling
httpssecurity - Route53 lets use choose and register a custom domain name (such as
pelican-town-produce.com) and link it to our S3 endpoint
We prefer this option because it's more secure, quicker, and more professional-looking than the basic S3 hosting.
Follow the link below for our step-by-step guide to creating and hosting your own static website right now using our IDE setup.
Lesson: Create and host a static website using S3 and CloudFront
Dynamic websites
A dynamic website is one whose content is compiled server-side when a user requests it -- as opposed to a static website, where the content is simply served from storage (such as from an S3 bucket).
This means that a dynamic website is able to display different content for different users, and if configured properly, can receive user-generated data.
Some examples of dynamic websites include:
- An artist's online shop that automatically puts a “sold out” sticker on out-of-stock items in her catalogue
- An educational platform that lets users register for an account to track their progress and receive badges
- A community forum that accepts and persistently displays user-generated comments and post interactions
What tools can we use from AWS to host a dynamic website?
Early on, some of our greatest friends in developing our static website into a dynamic one will be:
Lambda:server-side handling and computation of code (such as JavaScript), often overseeing the interactions of our S3 bucket with other AWS servicesSimple Email Service (SES):create and manage domain-based email communications that link to an external email account (such as Gmail), works withLambdato send event-based messagesIdentity and Access Management:manage assigned roles and permissions for different users, as well as granting permissions to Command Line Interfaces (CLI) in our IDECognito:create user pools to enable things like admin-only pages to edit your project without directly interfacing with AWS