what is codecommit and codebuild ?
CodeCommit – helps to store our code
CodeBuild- helps to building and testing our code
this is a brief introduction of codecommit and codebuilt now,
Let’s start how to use it
Step 1
To start any project you need to create the repository first, so click on the service category and then select developer tool then click CodeCommit
Step 2
First create a repository with the name “demo-app”. You can give a description about your application, also can add tag and if you want to review your code you can enable CodeGuru.Rightnow it is uncheck.
Step 3
Go to the IAM user and click security tab to give permission to add code the repository
After generating code you can now access to your CodeCommit
Step 4
Before pushing the code into CodeCommit add permission to the IAM user
Step 5
To push your code first clone your git repo under Clone url- clone HTTPS
Step 6
You can use any IDEs to develop your app and push the code into the repo, for now i am using VScode.create a folder and open it into VScode,then open the terminal and clone our repo
Now you can see your demo-app
Step 7
After cloning the repo, you might ask for credential information then add your credential information.
Now I am creating a simple index.html file to the repo and pushing into the CodeCommit repo.
The file is now visible into repository
Step 8
To build your app goto CodeBuild and click create project
Step 9
Now inside the create build project, first give a name of the project like “demo-app-build”
You can add some additional information, add some tags
Specify your primary source , it could be s3, github, CodeCommit, in my case i have choose CodeCommit then choose your repository.specify the branch and select the branch
In the Environment section I have chosen a managed image. You can choose your own custom image, operating system as ubuntu, runtime standard and image as latest.
To access all this configuration a new role is created by an IAM user as a service role, if you have any existing role you can choose or create a new one. If you want some changes like vpc
Privileges, compute certificates you can change in additional configuration.
Now you can create a build spec file to execute some commands, here i have created a buildspec.yml file and write certain commands to execute, the file is automatically executed when push on our repository. Here is the sample of “buildspec.yml” file
For the artifact I will configure later. And I uncheck for the cloudwatch logs and s3 logs.
Finally I created a build Project.
Step 9
We can now see our buildspec.yml file in our repo
Step 10
Now go to build project and select our build project and you are ready to build your project click start build
Step 10
You can track detail about your build process under phase details
conclusion
Simply using codecommit and codebuild helps to deploy application and also further pipeline can be created
