If you’re looking for a simple, serverless way to deploy a frontend application, AWS S3 + CloudShell is a fast and efficient option. In this post, I’ll walk you through how I deployed the Ridesmart Frontend โ a React app built with TypeScript โ using nothing but AWS CloudShell and the AWS CLI.
๐บ Watch the full deployment on YouTube:
๐ How I Deployed a React App to AWS S3 with CloudShell
๐งฑ Project Overview
Ridesmart Frontend is a static web application primarily written in:
- TypeScript (81%)
- SCSS
- HTML, CSS, JavaScript
Itโs built with React, and outputs a production-ready static site using npm run build
.
โ๏ธ Prerequisites
To follow along, youโll need:
- An AWS account with S3 permissions
- A bucket created for hosting (e.g.,
ridesmart-frontend
) - Basic knowledge of Node.js and the AWS CLI
You donโt need to install anything locally โ weโll be using AWS CloudShell, which comes with the AWS CLI preinstalled and has access to your AWS resources.
๐งฉ Step 1: Clone the Repository
First, open AWS CloudShell from the AWS Console. Then clone the project:
git clone https://github.com/DevOps-Journey-Pro/ridesmart-frontend.git
cd ridesmart-frontend
๐ฆ Step 2: Install Dependencies and Build the App
Install the required packages and build the app using npm:
npm install
npm run build
This generates a dist/
folder containing the optimized static files.
๐ชฃ Step: Create an S3 Bucket
Before uploading your build files, you’ll need to create an S3 bucket to host the app.
You can do this via the AWS Console or using the AWS CLI in CloudShell.
โ Using AWS Console:
- Go to the S3 service in your AWS Console.
- Click Create bucket.
- Set a unique bucket name (e.g.,
ridesmart-frontend
). - Choose a region.
- Under Object Ownership, select
ACLs disabled
. - Uncheck โBlock all public accessโ under permissions.
- Click Create bucket.
Donโt worry โ you can adjust permissions and hosting settings later.
โ Using AWS CLI:
aws s3api create-bucket \ --bucket ridesmart-frontend \
--region us-east-1 \
--create-bucket-configuration LocationConstraint=us-east-1
Replace
us-east-1
with your preferred AWS region.
โ๏ธ Step 3: Upload Files to S3
Use the AWS CLI to copy the contents of the dist/
folder to your S3 bucket:
aws s3 cp dist/ s3://ridesmart-frontend --recursive
๐ Step 4: Enable Static Website Hosting
In the S3 Console:
- Go to the Properties tab of your bucket.
- Scroll to Static website hosting.
- Click Edit, then enable it.
- Set the index document to
index.html
.
This tells S3 to serve the frontend as a static website.
๐ Step 5: Make the Files Public
To allow public access to your website, youโll need to:
1. Update the Bucket Policy
Go to the Permissions tab and paste this policy under “Bucket Policy”:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::ridesmart-frontend/*"
}
]
}
2. Disable Block Public Access
Still under Permissions, click โEditโ in the Block Public Access section and uncheck:
- Block all public access
Save changes.
โ Step 6: Access Your Website
Once hosting is enabled and permissions are set, you can access your site via the S3 endpoint:
http://ridesmart-frontend.s3-website-<region>.amazonaws.com
Replace <region>
with your S3 bucket’s region.
๐ฏ Conclusion
Deploying a frontend app to S3 using AWS CloudShell is quick and infrastructure-free โ perfect for static sites, prototypes, or admin dashboards.
For a step-by-step walkthrough, including CLI commands and console actions, check out the full video:
๐ Watch on YouTube
If you have questions or want to see this deployed behind CloudFront or with CI/CD, drop a comment or subscribe on YouTube.
For similar articles, read
๐ How to Copy Files To S3 Using an EC2 Instance (with AWS Console + CLI)
How to deploy a static website to Azure Storage using Azure DevOps
https://medium.com/@Anita-ihuman/deploying-a-react-app-using-aws-s3-and-cloud-front-c0950808bf03