Free TLS with Caddy Web Server on AWS EC2 with Let's Encrypt

Overview

In this tutorial we will see how to deploy a static website on AWS EC2 using Caddy web server with automatic HTTPS certificates from Let's Encrypt.

What you'll build:

• Complete AWS infrastructure (VPC, subnet, security groups, EC2 instance)

• DNS configuration via Route 53

• Caddy web server with automatic HTTPS

• Static website accessible via custom subdomain

• Production ready setup with HTTP to HTTPS redirect

all in less than 10 min

How Stakpak Helps?

You don't need to know anything about networking, or AWS or Caddy to sit it up, you dont need to go through documentation or Google commands

Step-by-Step Guide

Prerequisites

  1. Open your terminal and type "stakpak"

  2. Cloud provider credentials configured

  3. Then ask Stakpak to "install caddy on Ubuntu on EC2 "

  4. It will start by checking the AWS creds and region

  1. it will create

    1. Internet Gateway

    2. Attach Internet Gateway to VPC

    3. Create a public subnet

    4. Create a route table with an internet route

    5. Create security group (ports 22, 80, 443)

    6. Generate SSH key pair

  2. Now it will create the EC2 instance

  3. Now we drink coffee while the EC2 instance starts

  4. Now it will set the DNS and install Caddy, and test it

Now it's working🥳

Extra Resources:

References

Last updated