{"id":2105,"date":"2026-07-22T18:08:24","date_gmt":"2026-07-22T11:08:24","guid":{"rendered":"https:\/\/sumberlaba.com\/index.php\/2026\/07\/22\/how-to-deploy-a-react-app-to-aws-a-step-by-step-guide\/"},"modified":"2026-07-22T18:08:24","modified_gmt":"2026-07-22T11:08:24","slug":"how-to-deploy-a-react-app-to-aws-a-step-by-step-guide","status":"publish","type":"post","link":"https:\/\/sumberlaba.com\/index.php\/2026\/07\/22\/how-to-deploy-a-react-app-to-aws-a-step-by-step-guide\/","title":{"rendered":"How to Deploy a React App to AWS: A Step-by-Step Guide"},"content":{"rendered":"<h1>How to Deploy a React App to AWS: A Step-by-Step Guide<\/h1>\n<p>Deploying a React app to AWS is a reliable way to serve your frontend at scale. AWS offers multiple options\u2014Amazon S3 with CloudFront is a cost-effective, low-maintenance choice. This guide walks you through the essential steps to get your app live quickly.<\/p>\n<p>First, ensure you have a production build of your React app. Run <code>npm run build<\/code> in your project folder. This creates a <code>build<\/code> directory with optimized static files (HTML, JS, CSS). These files are all you need to host on AWS.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/via.placeholder.com\/800x600\/4a90d9\/ffffff?text=how%20to%20deploy%20a%20React%20app%20to%20AWS\" alt=\"Article illustration\" style=\"display:block;margin:20px auto;max-width:100%;height:auto;border-radius:8px;\" \/><\/p>\n<h2>1. Create an S3 Bucket<\/h2>\n<p>Log into your AWS Console and go to <strong>S3<\/strong>. Click \u201cCreate bucket\u201d, choose a globally unique name (e.g., <code>my-react-app-2024<\/code>), and select your region. Under \u201cBlock Public Access settings\u201d, <strong>uncheck<\/strong> \u201cBlock all public access\u201d and acknowledge the warning. Enable \u201cStatic website hosting\u201d in the Properties tab, enter <code>index.html<\/code> as the Index document.<\/p>\n<h2>2. Upload Your Build<\/h2>\n<p>Inside the bucket, click \u201cUpload\u201d and add all files from your <code>build<\/code> folder. Do not upload the folder itself\u2014just its contents. After upload, go to the <strong>Permissions<\/strong> tab and add this bucket policy to make files publicly readable:<\/p>\n<ul>\n<li>Open \u201cBucket Policy\u201d and paste: <br \/>\n  <code>{ \"Version\": \"2012-10-17\", \"Statement\": [ { \"Sid\": \"PublicReadGetObject\", \"Effect\": \"Allow\", \"Principal\": \"*\", \"Action\": \"s3:GetObject\", \"Resource\": \"arn:aws:s3:::your-bucket-name\/*\" } ] }<\/code><\/li>\n<li>Replace <code>your-bucket-name<\/code> with your actual bucket name.<\/li>\n<\/ul>\n<h2>3. Add CloudFront for HTTPS and Speed<\/h2>\n<p>Navigate to <strong>CloudFront<\/strong> and click \u201cCreate Distribution\u201d. Under Origin, select your S3 bucket (choose \u201cUse website endpoint\u201d if prompted). Set \u201cViewer protocol policy\u201d to <strong>Redirect HTTP to HTTPS<\/strong>. In the \ufffd\ufffd\ufffdDefault root object\u201d field, type <code>index.html<\/code>. Leave other settings default and create the distribution. Wait 5\u201310 minutes for it to deploy.<\/p>\n<h2>4. Configure Error Pages for SPA Routing<\/h2>\n<p>If your React app uses client-side routing (e.g., React Router), you must handle 404 errors. In your S3 bucket, go to Properties -> Static website hosting -> Edit. Under \u201cError document\u201d, enter <code>index.html<\/code>. This ensures any route like <code>\/about<\/code> serves your app entry point.<\/p>\n<p>Your React app is now live on AWS. Use the CloudFront domain name (e.g., <code>d123.cloudfront.net<\/code>) to access it. For a custom domain, add an alternate domain name in CloudFront and set up a Route 53 record. Always test thoroughly and consider enabling logging for production apps.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to Deploy a React App to AWS: A Step-by-Step Guide Deploying a React app to AWS is a reliable way to serve your frontend at scale. AWS offers multiple options\u2014Amazon S3 with CloudFront is a cost-effective, low-maintenance choice. This guide walks you through the essential steps to get your app live quickly. First, ensure &hellip; <\/p>\n","protected":false},"author":2716,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"footnotes":""},"categories":[],"tags":[],"class_list":["post-2105","post","type-post","status-publish","format-standard","hentry"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/posts\/2105","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/users\/2716"}],"replies":[{"embeddable":true,"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/comments?post=2105"}],"version-history":[{"count":0,"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/posts\/2105\/revisions"}],"wp:attachment":[{"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/media?parent=2105"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/categories?post=2105"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/tags?post=2105"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}