AWS Builder Center

From GitHub to Production: Building an Automated DevOps Deployment Pipeline on AWS

Learn how to build an automated CI/CD pipeline using GitHub Actions to deploy a React application onto an AWS EC2 instance managed by Nginx. This step-by-step guide covers server configuration, secure credential management with SSH, and custom domain integration.

Modern application development does not end when the code is written. A reliable process is needed to move code from development into a production environment safely, consistently, and with minimal manual effort.
To gain practical experience with this workflow, I built an end-to-end DevOps deployment project using a React + Vite application, AWS EC2, Nginx, GitHub Actions, Cloudflare, and Gmail SMTP.
The goal was to create a production-style environment where a code change pushed to GitHub could automatically reach a live server through a CI/CD pipeline.

Project Overview

The application was deployed on an Ubuntu-based AWS EC2 instance, with Nginx configured as the production web server.
The deployment architecture follows this basic flow:
Developer → GitHub → GitHub Actions → SSH → AWS EC2 → Build → Nginx → Live Application
The project also included custom domain configuration, email routing, and email authentication to make the environment more representative of a real-world deployment.

Hosting the React Application on AWS EC2

The first stage was preparing an AWS EC2 instance with Ubuntu as the operating system.
After launching the instance, I configured the required server environment and installed Node.js and npm to build the React + Vite application.
The application source code was maintained in GitHub, while the EC2 instance acted as the production server.
The React application was built into production-ready static files and deployed to:
 /var/www/html/ 
This directory was then served by Nginx.

Configuring Nginx as the Production Web Server

Nginx was configured to serve the compiled React application and handle incoming HTTP requests.
Instead of using the development server provided by Vite, the production build was served through Nginx.
This helped me understand an important distinction between development and production environments:
  • Vite development server is useful during development.
  • The production build generates optimized static files.
  • Nginx serves those files to users in the production environment.
This setup also provided hands-on experience with Linux server administration and web-server configuration.

Building the CI/CD Pipeline with GitHub Actions

One of the main objectives of the project was to eliminate manual deployment.
I implemented a GitHub Actions workflow that automatically runs whenever new code is pushed to the repository.
The deployment process follows these steps:
  1. Code is pushed to GitHub.
  1. GitHub Actions starts the deployment workflow.
  1. The workflow connects to the EC2 server using SSH.
  1. The latest application code is retrieved.
  1. Dependencies are installed using npm.
  1. The React application is built.
  1. The production files are deployed to  /var/www/html/ .
  1. Nginx serves the updated application.
This transformed the deployment process from a manual procedure into an automated CI/CD workflow.

Secure SSH-Based Deployment

The pipeline uses SSH to communicate with the EC2 server.
Rather than storing sensitive credentials directly inside the workflow file, deployment credentials were stored using GitHub Secrets.
This provided practical experience with secure credential management and demonstrated why secrets should not be hard-coded into source code or CI/CD configuration.
The overall approach was:
GitHub Actions → SSH authentication → EC2 server → Deployment
This is a simple but important pattern for understanding automated server deployments.

Connecting the Custom Domain

After successfully deploying the application, I connected a custom domain using Cloudflare DNS.
Cloudflare was used to manage the domain's DNS records and route traffic toward the production infrastructure.
This gave me practical experience with:
  • DNS records
  • Domain configuration
  • DNS propagation
  • Connecting domains to cloud infrastructure
  • Managing production application access through a custom domain
The application was made available through:
kamleshprasad.com

Setting Up Domain-Based Email

The project also included professional email configuration using the custom domain.
I configured Cloudflare Email Routing to forward messages from the domain to Gmail.
This allowed domain-based email addresses to be used while managing incoming messages through Gmail.
The configuration helped me understand how domain email routing works and how DNS is involved in email delivery.

Gmail SMTP Integration

I also configured Gmail SMTP for sending emails from the custom domain.
This provided hands-on experience with SMTP configuration and demonstrated how applications and infrastructure can send automated email notifications.
This type of setup can be useful for:
  • Deployment notifications
  • Monitoring alerts
  • System notifications
  • Backup reports
  • Application-generated emails

SPF, DKIM, and DMARC

Email authentication was another part of the project.
I configured SPF, DKIM, and DMARC records to improve email authentication and domain reputation.
These technologies helped me understand the different layers involved in securing domain-based email:
SPF helps specify which servers are authorized to send email for a domain.
DKIM adds a cryptographic signature that allows receiving mail systems to verify that an email was authorized by the domain.
DMARC provides a policy and reporting mechanism that builds on SPF and DKIM.
Although these are primarily email technologies, configuring them as part of the deployment project gave me a broader understanding of production infrastructure and DNS management.

Technologies Used

The project was built using:
  • Git
  • GitHub
  • GitHub Actions
  • AWS EC2
  • Ubuntu Linux
  • Nginx
  • Node.js
  • npm
  • React
  • Vite
  • Cloudflare
  • Gmail SMTP

Key DevOps Skills Demonstrated

This project gave me hands-on experience across several areas of DevOps and infrastructure management.

Cloud Infrastructure

Provisioning and managing an AWS EC2 instance provided practical experience with cloud-based infrastructure.

Linux Administration

I worked with Ubuntu, Linux commands, server directories, permissions, application deployment, and service configuration.

CI/CD Automation

GitHub Actions was used to automate the application deployment process and reduce manual intervention.

Web Server Management

Nginx was configured to serve the production React application.

Secure Deployment

SSH and GitHub Secrets were used to establish secure communication between the CI/CD workflow and the production server.

DNS and Domain Management

Cloudflare was used for domain and DNS configuration.

Email Infrastructure

Cloudflare Email Routing, Gmail SMTP, SPF, DKIM, and DMARC provided practical exposure to domain-based email infrastructure.

What I Learned

The biggest takeaway from this project was understanding how different DevOps components work together.
Previously, technologies such as AWS, Linux, GitHub Actions, Nginx, DNS, and SMTP could be learned individually. Building this project showed me how they fit together as one production workflow.
A simple code change can move through an entire chain:
Code → Version Control → CI/CD → Secure Connection → Cloud Server → Build → Web Server → End User
Understanding this complete workflow is much more valuable than learning each technology in isolation.

Future Improvements

This project also provides a foundation for adding more advanced DevOps practices.
Some possible improvements include:
  • Dockerizing the application
  • Adding automated testing to the CI pipeline
  • Implementing vulnerability scanning with Trivy
  • Adding Prometheus and Grafana monitoring
  • Creating automated backups
  • Adding deployment rollback mechanisms
  • Implementing HTTPS with SSL/TLS
  • Adding infrastructure monitoring and alerting
  • Using Infrastructure as Code with Terraform
  • Moving toward container orchestration with Kubernetes
These improvements would allow the project to evolve from a basic CI/CD deployment into a more complete DevOps platform.

Final Thoughts

This project was an important step in my DevOps learning journey because it required me to work with an actual deployment workflow rather than studying individual tools separately.
From provisioning an AWS EC2 server and configuring Nginx to building a GitHub Actions CI/CD pipeline and managing DNS and email infrastructure, I gained practical experience across multiple layers of a production environment.
The project helped me understand that DevOps is not simply about using tools. It is about connecting development, infrastructure, automation, security, and operations into a reliable workflow.
For me, this project represents a practical step toward becoming more confident in cloud infrastructure, Linux administration, CI/CD automation, and DevOps engineering.
Live Application: kamleshprasad.com
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article