Day 51: CI/CD pipeline on AWS - Part 2 ????
What is CodeBuild?
AWS CodeBuild is a fully managed build service in the cloud. CodeBuild compiles your source code, runs unit tests, and produces artifacts that are ready to deploy. CodeBuild eliminates the need to provision, manage, and scale your own build servers.
Task-01 :
Read about the Buildspec file for CodeBuild.
The build procedure for your CodeBuild project is specified in a Buildspec file, a YAML file. To build and bundle your program, CodeBuild will run a number of instructions from this file.
Create a simple index.html file in CodeCommit Repository.
you have to build the index.html using nginx server
Create a code commit repository
Copy clone HTTPS URL
Use the git clone command in git bash to copy the repository to your computer.
Create an index.html file inside the code commit repository.
With the git add and git commit commands, you can save the file and add the modifications to the repository.
git add <file-name>
git commit -m "commit message"
Using the git push command, add the modifications to the repository.
A straightforward index.html file can be found in your CodeCommit repository.
Task-02 :
Add buildspec.yaml file to CodeCommit Repository and complete the build process.
To build the file with a nginx server, create a Buildspec file.
Below are the functions of each build step:
With the git add and git commit commands, you can save the file and add the modifications to the repository.
Push the changes to the code commit repository
You have two files in your CodeCommit repository: buildspec.yml and index.html.
Create a project:
Visit the service for CodeBuild. Choose "Create build project" from the menu.
Your build project's name, source provider (CodeCommit), repository, and branch should all be entered.
领英推荐
Choose AWS CodeCommit as the source provider in the source area, then choose the repository you previously created and branch master.
In the Environment section, choose the operating system, and runtime ad image.
Choose "Use a buildspec file" in the "Buildspec" section when creating a new service role.
Click "Create build project" to create your project.
The project is successfully created.
To begin a fresh build, click the "Start construction" button.
Verify the status of the successful build.
Each step of the phase was successful.
to include artifacts and store them in an S3 bucket as part of a CodeBuild project.
Choose "Artifacts" under "edit" after clicking.
First, create an S3 bucket.
the bucket is successfully created.
Choose the Amazon S3 type and the bucket name you created in the previous step under Artifacts.
Choose "Update artifacts."
To begin a new build after updating artifacts, click the "Start build" button once more.
The built-in S3 bucket location will receive the artifacts after the build is finished.
The path of the file, which is /var/www/html/index.html, is specified in the artifacts phase of the buildspec.yml file. You can verify that the s3 bucket has folders and an index.html file.
Click on 'index.html' file, below you can see the properties of the file.
Click on 'open' on the right-hand side.
Here is an output of index.html file.
Thank you for sticking with me; I hope you learned something. ?? ??
Aspiring Devops Engineer || Linux | AWS | Jenkins |Github | Docker | Kubernetes | Terraform| Ansible
1 年Nice ??
Senior Cloud Engineer - Nagarro | Google Cloud Certified {"CDI, ACE , PCA, PDE}|Cloud DevOps Specialist | 5x GCP , Azure Certified | Devops | Linux | Docker | Terraform | Jenkins CI/CD | Kubernetes
1 年Good going !! Vinay Kumar
DevOps Engineer at BH Mobile Pte Ltd || AWS || Linux || CICD || Jenkins || Git GitHub || Docker || Kubernetes || Terraform ||
1 年Great work Vinay Kumar