DEV Community

Cover image for From Local to Live: Deploying My Landing Page on AWS with SSL
Osagie Anolu
Osagie Anolu

Posted on

From Local to Live: Deploying My Landing Page on AWS with SSL

Hey dev community! Today I'm excited to share my journey of deploying a landing page on AWS EC2, complete with SSL certification and a custom domain. Let's dive into the detailed process from server provisioning to the final deployment.

Project Overview

I created a landing page using HTML, CSS, and JavaScript, all contained in a single file. The goal was to deploy it securely on AWS EC2 and make it accessible through HTTPS. Here's how I made it happen.

Server Provisioning on AWS EC2

The first step was setting up the server infrastructure:

  1. Creating the EC2 Instance

    • Logged into AWS Management Console
    • Selected Ubuntu Server 22.04 LTS as the AMI
    • Chose t2.micro instance type (perfect for the free tier!)
    • Set up security groups to allow inbound traffic on ports:
      • Port 80 (HTTP)
      • Port 443 (HTTPS)
      • Port 22 (SSH)
  2. Server Access

    • Connected to the server using SSH with my key pair
    • Used the command: ssh -i my-aws-key.pem ubuntu@3.84.13.68
    • Elevated to root privileges using sudo -i for easier management

Setting Up the Web Server

The next crucial step was installing and configuring Apache:

  1. Apache Installation

    • Updated the server packages
    • Installed Apache web server
    • Verified the installation by checking Apache's status
    • Enabled Apache to start automatically on boot
  2. Project Deployment

    • Created a dedicated directory for the project
    • Downloaded the project files from GitHub
    • Installed necessary tools (like unzip)
    • Moved the files to Apache's root directory
    • Restarted Apache to apply changes

Domain Configuration and SSL Setup

This part was exciting - making the site secure and professional:

  1. Domain Setup

    • Purchased the domain 'osagieanolu.engineer' from name.com
    • Linked my EC2 instance's IP address to the domain
    • Set up proper DNS records
  2. SSL Certificate Installation

    • Installed Snapd package manager
    • Used Certbot for SSL certificate generation
    • Configured automatic certificate renewal
    • Set up a cron job for renewal checks twice daily

The Secret Sauce: Certbot Configuration

The SSL setup was particularly interesting. Certbot made the process surprisingly straightforward:

  1. Installation Process

    • Installed Certbot via Snap
    • Used the Apache plugin for automatic configuration
    • Followed the interactive prompts for domain verification
  2. Automation Setup

    • Configured automatic renewals
    • Verified the certificate installation
    • Set up quiet renewal processes to avoid notification spam

Challenges and Solutions

During the deployment, I faced several challenges:

  1. Permission Issues

    • Initially struggled with file permissions in /var/www/html/
    • Resolved by properly setting ownership and access rights
  2. DNS Propagation

    • Had to wait for DNS changes to propagate
    • Used DNS lookup tools to verify changes
  3. Apache Configuration

    • Needed to adjust Apache's default configuration
    • Ensured proper virtual host setup for SSL

Final Results

Image description
The deployment was successful!

Key Takeaways

This project taught me several valuable lessons:

  1. Always Plan Ahead

    • Having a clear deployment strategy saves time
    • Document each step for future reference
  2. Security First

    • SSL is crucial for modern web applications
    • Regular certificate renewal is essential
  3. Monitoring is Important

    • Regular checks of server status
    • Monitoring SSL certificate expiration

Next Steps

Future improvements I'm considering:

  1. Setting up a CDN for better performance
  2. Implementing server monitoring tools
  3. Adding backup automation
  4. Optimizing Apache configuration for better performance

For Those Following Along

If you're planning a similar deployment, here are some tips:

  • Double-check all security group settings
  • Keep your SSH key secure
  • Document your server configuration
  • Test your SSL setup thoroughly

Conclusion

Deploying a landing page on AWS with SSL might seem daunting at first, but breaking it down into steps makes it manageable. The combination of AWS EC2, Apache, and Certbot provides a robust foundation for hosting secure web applications.

Have you deployed any projects on AWS recently? What challenges did you face? Let's discuss in the comments below!


Top comments (0)