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

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

Day 50

ยท

4 min read

Making a CI/CD pipeline on AWS with these tools.

  • CodeCommit

  • CodeBuild

  • CodeDeploy

  • CodePipeline

  • S3

What is CodeCommit?

AWS CodeCommit is a fully managed source control service provided by Amazon Web Services (AWS). It is designed to host and manage private Git repositories for software development teams. CodeCommit allows you to securely store and version control your code assets, collaborate with team members, and easily integrate with other AWS services and developer tools.

Key features of AWS CodeCommit include:

  1. Git-Based Repositories: CodeCommit supports the widely used Git version control system, allowing you to create and manage repositories for your source code.

  2. Secure and Private: CodeCommit provides secure access control mechanisms to ensure the confidentiality and integrity of your code. You can use AWS Identity and Access Management (IAM) to manage user and group permissions.

  3. Scalability and High Availability: CodeCommit is built on AWS's highly scalable and reliable infrastructure, ensuring that your repositories are available and performant even as your codebase and team grow.

  4. Integration with AWS Services: CodeCommit seamlessly integrates with other AWS services like AWS CodePipeline, AWS CodeBuild, AWS CodeDeploy, and AWS CloudFormation, enabling you to build end-to-end automated software delivery pipelines.

  5. Collaboration: CodeCommit allows multiple developers to collaborate on code repositories by providing features like pull requests, branch management, and code reviews.

  6. Encryption and Data Protection: CodeCommit encrypts your data at rest using AWS Key Management Service (KMS), and it also supports encryption in transit using SSL/TLS.

  7. Notifications and Triggers: You can set up event notifications and triggers using Amazon Simple Notification Service (SNS) or AWS Lambda, allowing you to automate actions based on repository events.

By using AWS CodeCommit, teams can effectively manage their source code and collaborate on software development projects in a secure and scalable manner, leveraging the power of Git and AWS services.

Task-01

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

    • Go to the AWS Management Console and navigate to the CodeCommit service.

    • Click on "Create repository" to create a new repository.

    • Provide a name and optional description for your repository.

      Click on "Create repository" to create the CodeCommit repository.

  • You need to setup GitCredentials in your AWS IAM.

    To set up Git credentials for AWS IAM, you need to perform the following steps:

    1. Create or Update IAM User:

      • Go to the AWS Management Console and navigate to the IAM service.

        Create a new IAM user or select an existing user that you want to use for Git authentication.

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

        Scroll down to the Security credentials section.

      • Under security credentials, scroll down and come to the '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 are created.

  • 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'.

    • Open a terminal on your local Ubuntu 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. (Note: Your user has aws codecommit permission to perform this action)

Task-02

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

    • Create a new file in the local repository directory.

    • Check status using the 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 the content of the file.

Thankyou....

ย