DevOps Project - 12 (Step-by-step Implementation)

DevOps Project - 12 (Step-by-step Implementation)

Project 10: Build a website using AWS CodeCommit and AWS CodeBuild.

Here is the Architecture:

No alt text provided for this image


1.?????First of all, to start with AWS DevOps, we need to create a user by using the IAM service with some specific access.

2.?????Storage – In this storage part we will store our built code for that we will use Artifacts or S3 buckets.

3.?????CodeCommit - CodeCommit is just like GitHub inside AWS. We can perform push, pull, branching on the repositories, and many other operations.

4.?????CodeBuild - Now, the pushed code in CodeCommit, should be built and tested (Continuous Integration (CI)). This will happen inside CodeBuild. And the built code will be stored in Storage.


Step-By-Step Implementation:

1.?????Goto the AWS console and search for “CodeCommit” and click on “Create Repository.”

No alt text provided for this image


2.?????Enter the Name and Description then click on Create.

No alt text provided for this image


3.?????The Repository was created successfully. But it is giving an error as “You cannot configure SSH using root account”.

No alt text provided for this image


4.?????Now, search for IAM and create one user.

No alt text provided for this image


5.?????Now, open the created user and search for “HTTPS Git credentials for AWS CodeCommit” and click on “Generate Credentials”.

No alt text provided for this image


It will generate the Username and Password.

6.?????Now, we will clone the “demo-app” repository that we have created in CodeCommit.

7.?????Click on “Clone URL” then “Clone HTTPS” and it will provide you the URL.

No alt text provided for this image


8.?????Now, go to your local computer and create a folder named “AWS DevOps” And open the terminal inside.

No alt text provided for this image


9.?????Run, “git clone https://git-codecommit.us-west-1.amazonaws.com/v1/repos/demo-app

No alt text provided for this image


10.??It will ask for Username and Password. Enter it in the prompt.

No alt text provided for this image


11.??Now add one file named “index.html”.

No alt text provided for this image


12.??Push it into the repository. And boom! Code will be reflected to the repository.

No alt text provided for this image


CodeBuild:

13.??Now, here comes the CodeBuild. On LHS, click on “Build” then “Build projects”.

14.??Click on “Create build project”.

No alt text provided for this image


15.??Enter the Name and Description of the project.

No alt text provided for this image


16.??In Source section, Select

Source provider: AWS CodeCommit.

Repository: demo-app

Reference Type: Branch

Branch: Main

No alt text provided for this image


17.??In the Environment section, Select

Environment Image: Managed Image

Operating System: Ubuntu

Runtime: Standard

Image: <latest one>

No alt text provided for this image


18.??For this, a Service Role will be required and it will create automatically when we will select the “New Service Role”

No alt text provided for this image


19.??In the BuildSpec section, click on “Use a buildspec file”.

No alt text provided for this image


20.??Add a file named “buildspec.yaml” in the “demo-app” repository.

(Build file is basically a specification file, that will give the instructions, while building).

No alt text provided for this image
No alt text provided for this image


21.??Now, the rest of the things leave as it is, and click on “Create Build Project”.

No alt text provided for this image


22.??Now, click on “Start Build”.

No alt text provided for this image


23.??Here, you can see the “Phase Details”.

No alt text provided for this image


24.??The code has been built.

No alt text provided for this image


25.??We can give “Artifacts upload location” if we want to build the code on some specific location.

26.??Goto “Edit” button and click on “Artifacts”

No alt text provided for this image


27.??Here, select

Type: S3 Bucket. (Create a new s3 bucket if you haven’t created it)

Bucket Name: <Your created bucket>

Name: <Your folder name in S3 bucket> (Go and create one)

No alt text provided for this image


And click on “Update Artifact”.


28.??Next time, whenever you will start a build, your files will go there.

29.??Let’s give it a try by building it.

No alt text provided for this image


30.??Here, you can see artifacts.zip uploaded to S3 bucket successfully.

No alt text provided for this image


We will deploy this code with the help of “CodeDeploy” and automate it with “CodePipeline” in the next project article.????

Hope you found this helpful. Do connect/ follow for more such content.

~ Chetan Rakhra.

Dmytro Protsenko

Co-Founder | CEO | Passionate about Development, ODOO, DevOps, and Support Services

1 年

I'm incredibly grateful for your detailed article on building a website using AWS CodeCommit and AWS CodeBuild.?

Nicole Bre?a Ruelas

Content Creator | Culture & Marketing Specialist at Sonatafy Technology

1 年

Thanks for sharing :)

Vaishnavi Shinde

8K+ LinkedIn Family || DevOps Engineer || Docker | Kubernetes | Linux | Terraform | Ansible | AWS | Git |

1 年

Thanks for sharing!!

Jyotirmayee Parida

Aspiring DevOps Engineer | AWS, Docker, Kubernetes Enthusiast | Skilled in Graphic Design | Specializing in Generative AI on AWS

1 年

This is so helpful

Divya Tripathi

3+ Years Experience | PAAS | IAAS | Azure Devops | CICD | Terrafrom | Azure Data Analytics| Actively looking for New Opportunity | Appreciated the Refferals

1 年

Thank you for sharing your knowledge with us. It's really very helpful content for beginners. Keep posting such contents.

要查看或添加评论,请登录

社区洞察

其他会员也浏览了