Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
March 28, 2022 04:49 pm GMT

Add a CI/CD pipeline to an Amazon S3 bucket

Pre-requisites:

  1. GitHub account & own repository to commit files.
  2. AWS account , access to management console.

This is a beginner friendly hands on exercise to learn the power of CI/CD in the AWS cloud. It will deploy the changes from your repository in GitHub to the S3 bucket which acts as a static website host.

S3 bucket

Create a S3 bucket which has website hosting enabled.

Commit Pipeline

In this pipeline one defines as to what stages the code commit has to go through before it can be deployed.
It has 3 components:
1.Source stage: Define where the code will be picked up from to deploy it in the cloud. One can see a variety of options while specifying the stage. For Github, install the AWS Github connector to connect to your repository.Select the repository which will be the source for the artifacts & the corresponding branch in the repository.

Image description

2.Build stage(optional): You can specify how you want your code to be built using a yaml script. I have skipped this step as my changes are to the index.html file

3.Deployment stage: Either the build stage or deployment stage should be present. This stage also has different options regarding where to deploy the code.

Image description

Commit code to Github :

After the above two steps are completed, make changes to your code in html file which serves as the landing page for your website & commit the file. Voila!!!! Within seconds you can see that the commit pipeline is triggered & your changes are deployed to the S3 bucket mentioned in the deployment stage.

Below is the result of my code change & this hands on lab:

Before commit:

Image description

After commit:

Image description


Original Link: https://dev.to/neetumallan/deploying-commits-from-github-repo-to-aws-s3-bucket-4f2l

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To