Day 50: CI/CD pipeline on AWS - Part-1 🚀 ☁☁

Day 50: CI/CD pipeline on AWS - Part-1 🚀 ☁☁

What is CodeCommit ?

AWS CodeCommit is a fully managed source control service provided by Amazon Web Services (AWS). It is designed to securely store and manage private Git repositories. CodeCommit enables teams to collaborate on software development projects and version control their code repositories.

Here are some key features and aspects of AWS CodeCommit:

  1. Git-Compatible: CodeCommit is compatible with the popular Git version control system. It supports all Git commands and workflows, allowing developers to easily push, pull, clone, and branch their code repositories using standard Git tools and clients.

  2. Secure and Private: CodeCommit provides secure and private Git repositories. It integrates with AWS Identity and Access Management (IAM) to manage user access and permissions. Encryption at rest and in transit ensures the confidentiality and integrity of your code.

  3. Scalable and Highly Available: CodeCommit is built on AWS infrastructure, which is designed for scalability and high availability. It automatically scales to handle large repositories and can accommodate multiple concurrent users and teams.

  4. Collaboration Features: CodeCommit supports collaboration among team members. It allows multiple developers to work on the same repository simultaneously, merge changes, and manage conflicts. CodeCommit also integrates with other AWS developer tools, such as AWS CodePipeline and AWS CodeBuild, to enable continuous integration and continuous delivery (CI/CD) workflows.

  5. Integrated with AWS Ecosystem: CodeCommit seamlessly integrates with other AWS services, making it easy to build end-to-end development workflows. For example, you can trigger code deployments or build processes using AWS CodePipeline based on changes in your CodeCommit repository.

  6. Branching and Pull Requests: CodeCommit supports branching and pull requests, enabling teams to work on separate branches and submit changes for review and merging. This helps maintain code quality and facilitates collaboration in larger development teams.

  7. Auditing and Visibility: CodeCommit provides detailed audit logs and visibility into repository activities. You can track changes, view commit history, and analyze user actions using CloudWatch Logs and AWS CloudTrail.

    Benefits Of AWS CodeCommit:

    • Store any type of Code: AWS CodeCommit lets you store any type of code as there are very fewer restrictions on the type and the extensions of the code that you store.

    • Fully Managed: AWS CodeCommit eliminates the need to host, maintain, back up, and scale your own source control servers. The service automatically scales to meet the growing needs of your project.

    • Faster development lifecycle: AWS CodeCommit keeps your repositories close to your build, staging, and production environments in the AWS cloud. You can transfer incremental changes instead of the entire application. This allows you to increase the speed and frequency of your development lifecycle.

    • Scale Easily: When you talk about cloud platforms and any service, it ensures scalability so does the amount of code you push on this particular service.

Task-1

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

🔎Step1: Go to the AWS Management Console and navigate to the CodeCommit service.

🛠Step 2: Go to CodeCommit page . Click on "Create repository" and Setup your Code Repository.

✏Step3: Create a name for your Repo

✔Step 4: Click on the Create button. Now Successfully Repository Created.

🔑Step 5: Now, Generate Git credentials. Go to IAM Service.

⚙Step 6: Select “Users” in the left navigation pane and click on Create user button.

🖊Step7: Give a name to the user.

  • Checkbox for Provide user access to the AWS Management Console — optional

  • Select I want to create an IAM user and give password

    🔐Step 8: In these Set Permissions , Click on Attach Policies Directly

    1. Select the policy AWSCodeCommitFullAccess

    2. Click on Next.

      📃Step 9: Review the details and Click on Create User.

      📒Step 10: Download the .csv file since this is the only time you can view and download this password.

      📖Step 11: Open the User you created. Go to the Security Credentials tab.

      📚Step 12: Scroll down to HTTPS Git credentials for AWS CodeCommit. Select Generate Credentials. Download credentials and click on Close.

      This is the Git credentials for accessing CodeCommit.

      📜Step 13: Now, Clone the repository from CodeCommit. In the CodeCommit dashboard, click on HTTPS to copy the URL.

      📌Step14: Use those credentials in your local and then clone the repository from CodeCommit

      • In Code Commit, Go inside the repository that you created in the above steps, in the right-hand side click on 'Clone URL' and choose 'Clone HTTPS'

      • Run the following command:

        git clone <https>
        git clone https://git-codecommit.us-east-1.amazonaws.com/v1/repos/CodeCommit-Repo
  • You will be prompted to enter your Git credentials. Enter the username and password that you downloaded earlier.

    Yes! You have created an empty repository in AWS CodeCommit and cloned it to your local.✨✨

    Task 2:

    Add a new file from local and commit to your local branch. Push the local changes to the CodeCommit repository.

    ✏Step 1: Add a new file from local and commit to your local branch.

  • Create a new file in the local repository directory.

      git add filename
      git status
    

    🛠Step 2: Add these files to the staging area, using the above git commands

    📂Step 3: To add these in the local repositories history, use the below commad.

      git commit -m "Commiting the files I created now"
    

💨Step 4: Now, Push the changes to the CodeCommit repository using the below command.

        git push origin master

✔Step 5: Verify that the files are pushed into the CodeCommit repository.
In the CodeCommit Repository > Repositories >We have "test1" file here which was pushed from local EC2 instance.

Yes! You have pushed your local files to the CodeCommit Repository.🎉✨

Conclusion:

By leveraging features, AWS CodeCommit simplifies the process of managing code repositories, version control, collaboration, and integration with other development tools. It provides a secure and reliable environment for teams to store and manage their code, enabling smooth software development workflows.

The ability to easily integrate with other AWS services make AWS CodeCommit a valuable solution for version control in cloud-based development environments.

Thank you for 📖reading my blog, 👍Like it and share it 🔄 with your friends.

Happy learning😊😊