Day 50 - Your CI/CD pipeline on AWS - Part-1 ๐Ÿš€ โ˜

Day 50 - Your CI/CD pipeline on AWS - Part-1 ๐Ÿš€ โ˜

ยท

3 min read

What if I tell you, in the next 4 days, you'll be making a CI/CD pipeline on AWS with these tools?

  1. CodeCommit

  2. CodeBuild

  3. CodeDeploy

  4. CodePipeline

  5. S3

What is CodeCommit?

CodeCommit is a managed source control service by AWS that allows users to store, manage, and version their source code and artefacts securely and at scale. It supports Git, integrates with other AWS services, enables collaboration through branch and merge workflows, and provides audit logs and compliance reports to meet regulatory requirements and track changes. Overall, CodeCommit provides developers with a reliable and efficient way to manage their codebase and set up a CI/CD pipeline for their software development projects.

Task-01 :

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

  • You need to set up GitCredentials in your AWS IAM.

  • Use those credentials in your local and then clone the repository from CodeCommit

Step 1: Creating a repo in CodeCommit (AWS)

  1. Login to Aws console.

  2. Search for Code Commit and click on Create repository

Give it a name and click on Create

As a root user you cannot access the CodeCommit repo, so we need to create an IAM user with certain policies

Step2: Setting up GitCredentials in your AWS IAM

  1. Navigate to IAM > Users

  2. You can create a new user by clicking Add Users

  3. Give him an AWSCodecommitPowerUser Policy permissions

  4. Click on Create user

Open the User and go to Security Credentials

Under Security credentials > HTTPS Git credentials for AWS CodeCommit

Click on Generate credentials

Download credentials and click on Close

HTTPS GIT credentials are created now.

Step 3: Cloning the repository from CodeCommit to local

  1. Open your repository from the code commit

  2. Select the repository and click on the Clone URL > Clone HTTPS

  3. Once you do this repo URL will be copied and we will be cloning it in local

  1. Connect to the EC2 instance now and use the git clone command to clone the code from the code commit
$ git clone <your-codecommit-repo-clone-https-url>

Enter the HTTPS GIT Credentials that you created and downloaded from the code commit

Note: Make sure you add proper policies for the IAM role


Task-02 :

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

  • Push the local changes to the CodeCommit repository.

  1. Create a file called Index.html in local

  2. Use the Git commands to push the file to the CodeCommit repository

Now check the repository on the CodeCommit, we should see the index.html file

ย