DEV Community

S Bhavi Vishnu
S Bhavi Vishnu

Posted on

Hosting React application using s3 and cloudfront

STEP 1:
1.1:check node and npmis already installed or not.if not, install npm and node.
1.2: Create a new project with vite build command ,Enter your project name
1.3:Select framework "REACT".
1.4:Select a varient "TYPESCRIPT".
1.5:Now run the above three commands.
Image description
STEP 2:Check localhost:5173
Image description
STEP 3:Now our react spplication is created successfully.
Image description
STEP 4:Open the project in vs code then run the command "npm run build".This command compiles and bundles your source code and placed in a directory dist.
STEP 5:Create a bucket with unique name.
Image description
Image description
STEP 6:enable static web hosting.
Image description
STEP 7:Add bucket policy.
Image description
STEP 8:Now upload the files and folders from the dist folder in your bucket.
Image description
STEP 9:Go to properties,scroll down,you can find bucket website endpoint,then click it.

Image description
STEP 10:our react application is hosted in s3.
Image description
STEP 11:Now create a cloudfront distribution for hosting a react application.
Image description
Image description
STEP 12:Copy the distribution domain name and paste it in a new tab.Now we can see the same result.
Image description
STEP 13:Finally delete the cloud front distribution.
Image description

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay