As it is, we have had to use BitBucket as the repo for our website, and we use the Pipelines feature on there to deploy to S3. Would be nice not to have to use a third party service to do something that AWS's own infrastructure makes unreasonably complex and difficult.
Deploying front-end websites to S3 with CloudFront
21–30 of 33 posts
Re: Deploying front-end websites to S3 with CloudFront
#22Re: Deploying front-end websites to S3 with CloudFront
#23Configuring CORS is probably the biggest pain about this approach and is necessary if you want to send data to and from an API. This guide should probably mention it or link another guide.
I've found a fairly workable solution is to have an origin for the API in CloudFront and a behaviour to route /api/* to that origin. Saves any CORS headaches. Obviously this won't work in all cases.
Re: Deploying front-end websites to S3 with CloudFront
#24Re: Deploying front-end websites to S3 with CloudFront
#25Configuring CORS is probably the biggest pain about this approach and is necessary if you want to send data to and from an API. This guide should probably mention it or link another guide.
I've found a fairly workable solution is to have an origin for the API in CloudFront and a behaviour to route /api/* to that origin. Saves any CORS headaches. Obviously this won't work in all cases.
(Of course, you can rewrite the URL on the fly via Lambda@Edge but that's a PITA to maintain)
Re: Deploying front-end websites to S3 with CloudFront
#26I've always wondered why Amazon's own CodePipeline service could not deploy a commit of a HTML/CSS static sites straight to S3. They can deploy from CodeCommit straight to Elastic Beanstalk easily enough, but for years I have been asking for an S3 bucket as a destination which would make deploying our static website a piece of cake. As it is, we have had to use BitBucket as the repo for our website, and we use the Pi…
Re: Deploying front-end websites to S3 with CloudFront
#27A problem my team hits with micro projects with this is: virtual routes like `/login` doesn’t map to a file. What can be done about that?
/login makes me think your website isn't really static. Regardless, you can use extensionless links with your static website if you rename the file from login.html to login, then change the file metadata to Content-Type: 'text/html'
Re: Deploying front-end websites to S3 with CloudFront
#28You should have a look at AWS Amplify Console https://aws.amazon.com/amplify/console/ It’s specifically designed to do most of this for you. I’ve been using it for static site work recently and it’s awesome. It also does plenty more and can be used for full stack dev but it’s great if you just need static site hosting and build pipelines. No need to have the build locally and uses gitops for build and auto generates…
Re: Deploying front-end websites to S3 with CloudFront
#29I've always wondered why Amazon's own CodePipeline service could not deploy a commit of a HTML/CSS static sites straight to S3. They can deploy from CodeCommit straight to Elastic Beanstalk easily enough, but for years I have been asking for an S3 bucket as a destination which would make deploying our static website a piece of cake. As it is, we have had to use BitBucket as the repo for our website, and we use the Pi…
Re: Deploying front-end websites to S3 with CloudFront
#30A problem my team hits with micro projects with this is: virtual routes like `/login` doesn’t map to a file. What can be done about that?
We have multiple React sites deployed this way to S3/Cloudfront with react-router and experience no issues.