DevOps Project - 12 (Step-by-step Implementation)
Project 10: Build a website using AWS CodeCommit and AWS CodeBuild.
Here is the Architecture:
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.”
2.?????Enter the Name and Description then click on Create.
3.?????The Repository was created successfully. But it is giving an error as “You cannot configure SSH using root account”.
4.?????Now, search for IAM and create one user.
5.?????Now, open the created user and search for “HTTPS Git credentials for AWS CodeCommit” and click on “Generate Credentials”.
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.
8.?????Now, go to your local computer and create a folder named “AWS DevOps” And open the terminal inside.
9.?????Run, “git clone https://git-codecommit.us-west-1.amazonaws.com/v1/repos/demo-app ”
10.??It will ask for Username and Password. Enter it in the prompt.
11.??Now add one file named “index.html”.
12.??Push it into the repository. And boom! Code will be reflected to the repository.
CodeBuild:
13.??Now, here comes the CodeBuild. On LHS, click on “Build” then “Build projects”.
14.??Click on “Create build project”.
15.??Enter the Name and Description of the project.
16.??In Source section, Select
Source provider: AWS CodeCommit.
Repository: demo-app
领英推荐
Reference Type: Branch
Branch: Main
17.??In the Environment section, Select
Environment Image: Managed Image
Operating System: Ubuntu
Runtime: Standard
Image: <latest one>
18.??For this, a Service Role will be required and it will create automatically when we will select the “New Service Role”
19.??In the BuildSpec section, click on “Use a buildspec file”.
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).
21.??Now, the rest of the things leave as it is, and click on “Create Build Project”.
22.??Now, click on “Start Build”.
23.??Here, you can see the “Phase Details”.
24.??The code has been built.
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”
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)
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.
30.??Here, you can see artifacts.zip uploaded to S3 bucket successfully.
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.
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.?
Content Creator | Culture & Marketing Specialist at Sonatafy Technology
1 年Thanks for sharing :)
8K+ LinkedIn Family || DevOps Engineer || Docker | Kubernetes | Linux | Terraform | Ansible | AWS | Git |
1 年Thanks for sharing!!
Aspiring DevOps Engineer | AWS, Docker, Kubernetes Enthusiast | Skilled in Graphic Design | Specializing in Generative AI on AWS
1 年This is so helpful
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.