简体   繁体   中英

AWS Code Pipeline - Deploying a React app to S3 bucket

I have a seemingly simple task of trying to deploy a react app to an S3 bucket to use it as a website. I have followed several tutorials and attempted this numerous times and numerous ways. All of them have failed and I am finding this incredibly frustrating and the docs are no help.

Following this example , I set up a pipeline. I don't need a build, just a deploy that triggers on github push to deploy the built code to the S3 bucket.

I believe that my first problem came at the object key - something which simply isn't in a single AWS doc or example that I could find.

在此处输入图像描述

Do I need to enter the files in the build folder, or the files in the public folder. If I enter an object key of "build/index.html", it pulls those files into the S3 bucket in example that same way, which is obviously not ideal.

I believe that these object keys are the files that the code pipeline is going to pull over - although an explanation of that somewhere would be nice. So, how do I enter the object keys for a react app?

I also tried uploading the files manually to the S3 bucket and using that as a website, but it simply downloaded the files instead of running the code and viewing it as a website.

Check "Extract file before deploy" then you can skip Deployment path as empty if you want to deploy your files in root directory. When check "Extract file before deploy" S3 bucket Key field will be disappeared.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM