Creating a deployment pipeline for React apps from Github to S3 static buckets is easy with AWS CodePipeline and AWS Codebuild – this video shows you how to do it step by step and even demonstrates how you can also add a custom domain name, SSL certificate and CloudFront distribution. Of course you can adapt this pipeline to work with other javascript frameworks or even simple static websites. In the case of static websites you would leave out CodeBuild from the whole setup.
If you’re interested in setting up this whole pipeline with CloudFormation templates then you can do that as well. I have created two separate CloudFormation templates:
- Simple setup with just CodePipeline, CodeDeploy and S3 static website. For this template go here: https://majestic.cloud/cfntemplate/react-continuous-deployment-pipeline-from-github-to-s3-with-aws-codepipeline-and-aws-codebuild/
- Advanced setup which also adds a custom domain name, an SSL certificate and a CloudFront distribution. For this template go here: https://majestic.cloud/cfntemplate/advanced-react-continuous-deployment-pipeline-from-github-to-s3-with-aws-codepipeline-and-aws-codebuild/
You will find all the code used in the video (policies, buildspec, CloudFormation templates, etc) in the following github repository: https://github.com/majestic-cloud/react-deployment-pipeline
For a complete demo watch the video below: