AWS Lightsail is a simpler subset of AWS intended for IT beginners. This week, AWS announced support for CloudFront CDNs in Lightsail, with fixed monthly pricing starting at $2.50. We’ll walk through setting up a high-performance website on Lightsail.
A Content Delivery Network (CDN) speeds up your website by caching it closer to users around the world. It ensures that even if you only have a server in one location, users in other regions can still access it quickly. It also takes some stress off your primary web server, because users will be hitting cache instead of requesting it from your origin every time.
Setting Up a Lightsail Website
Head over to the Lightsail Management Console and create a new instance. There are a few “Blueprints” you can choose from, which are preset images that come with software preinstalled, like WordPress or NGINX.
You’ll probably want to add your SSH keys here, and turn on Automatic Snapshots that will create incremental backups every day.
Lightsail has a few tiers for compute instances to choose from, which you can sort by memory, CPU, storage, or bandwidth.
Lightsail will take a few minutes to set up your instance and install any software on it.
Enabling CloudFront CDN
From the Networking tab, click “Create Distribution.
The origin of your CDN will be the web server instance. Select this from the dropdown, but if you don’t have a static IP address assigned, you’ll have to create one here.
The CDN has a few different preset options for cache behavior. If you’re using WordPress, Lightsail will default to “best for WordPress.” Otherwise, you can set it to “Best for static sites” or configure it yourself.
Pricing for the CDN is determined by how much bandwidth you’ll be expecting. The lowest tier, 50 GB, is $2.50 per month. Data for AWS goes at about $0.09 per GB, so these tiers are actually very cheap compared to regular AWS prices.
The CDN will take a few minutes to set up, but once it’s done it should be available from the URL given to you in the console. You’ll need to configure your DNS to point to this endpoint.