CI/CD PIPELINE on AWS..
CodeCommit: A Git-Based Repository Solution”

Nipulpatel
4 min readSep 30, 2023

--

What is CodeCommit ?

AWS CodeCommit is a fully managed source control service that allows you to store and manage your code securely in the cloud. It provides a private Git repository for your code and supports all Git commands and workflows.

For example, if you have a team of developers working on a project, they can use CodeCommit to collaborate and manage their code changes. Each developer can clone the repository to their local machine, make changes, and then push those changes back up to the central repository in CodeCommit.

CodeCommit also integrates with other AWS services like AWS CodePipeline and AWS CodeBuild, allowing you to automate your entire software release process. This can help you streamline your development workflows and improve the overall efficiency of your team.

Set up a code repository on CodeCommit and clone it on your local.

Log in to the AWS Management Console and navigate to CodeCommit.

Click on Create Repository.

  • Enter a name for your repository and select the options for repository description, default branch name, and repository visibility.
  • boon123-Repository Successfully Created.

You need to setup Git Credentials in your AWS IAM.

Go to the IAM console

Click on Users in the left-hand menu, and then click on your username.

  • Scroll down to the Security credentials section.
  • In ‘HTTPS Git credentials for AWS CodeCommit’ section, click on ‘Generate credentials’
  • Click on the Download credentials button to download your Git credentials and click on ‘close’.
  • Git credentials is created.
  • Use those credentials in your local and then clone the repository from CodeCommit
  • In Code Commit, Go inside your repository that you created in above steps, in right-hand side click on ‘Clone URL’ and choose ‘Clone HTTPS’.
  • Open a terminal on your local machine.
  • Navigate to the directory where you want to clone the repository.
  • Run the following command:

git clone <your-codecommit-repo-clone-https-url>

  • You will be prompted to enter your Git credentials. Enter the username and password that you downloaded earlier.
  • You have now set up a CodeCommit repository and cloned it on your local machine using Git Credentials in AWS IAM.

Add a new file from local and commit to your local branch

Create a new file in the local repository directory.

Check status using command ‘git status’.

Add the new file to your local branch using the following command:

git add <filename>

Commit the changes to your local branch using the following command:

git commit -m “added new file”

Push the local changes to CodeCommit repository.

Push the changes from your local branch to the CodeCommit repository using the following command:

git push origin master

Verify that the changes have been pushed to the CodeCommit repository:

Go to the code commit repository that you created earlier, you should see the new file listed in the repository’s files.

You can see content of the file.

conclusion: how CodeCommit service can be used to create and clone repositories so that users can collaborate and work on writing efficient code. The powerful thing with CodeCommit is that it can be integrated with various DevOps tools to make the building process easier.

thank you !!!!

--

--

No responses yet