在 AWS Cloud Front 中部署 ReactJS 应用程序

Deploy ReactJS Application in AWS Cloud Front

我有一些关于在云端部署 React 应用程序的问题。

Cloud Front 上托管的前端网站的缓存和更新如何工作?

When I upload a new files to the bucket I will see the changes IMEDIATELY after accessing the site again? If not, how long it will take?
I need to make an invalidate request to see the changes working on the website? If yes, how long it will take?

在 Cloud Front 中处理单页应用程序缓存和更新的最佳方法是什么? (我正在使用 React 应用程序和 Webpack)

您需要做的是清除存储桶或 "invalidating" 文件的缓存。

https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html

因此安装 aws cli 和运行以下命令:

aws cloudfront create-invalidation --distribution-id $CDN_DISTRIBUTION_ID --paths "/*"

我建议您使用 S3 存储桶进行开发。