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

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

ยท

4 min read

In the fast-paced world of software development, Continuous Integration and Continuous Deployment (CI/CD) pipelines have become indispensable tools for ensuring efficient and reliable delivery of software applications. With AWS providing a comprehensive suite of services tailored for developers, setting up a robust CI/CD pipeline has never been easier.

Over the next four days, we'll embark on a journey to create a CI/CD pipeline on AWS using some of its key tools: CodeCommit, CodeBuild, CodeDeploy, CodePipeline, and 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 artifacts 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.

Log in to your AWS Management Console.

Navigate to the CodeCommit service.

Click on the "Create repository" button.

Enter a name for your repository (e.g., "my-project").

Optionally, you can add a description and configure other settings as needed.

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

The repository is successfully created.

You need to setup Git Credentials in your AWS IAM.

Go to the AWS IAM (Identity and Access Management) service in the AWS Management Console.

Click on "Users" in the left sidebar and then click on "Create user."

Enter a username for your IAM user (e.g., "git-user").

Select the "Programmatic access" checkbox to generate access keys for Git operations.

Click on "Next: Permissions" to proceed.

Attach a policy that grants CodeCommit access to this user. You can use the "AWSCodeCommitPowerUser" policy for this purpose.

Click on "Next: Tags" (optional) and then "Next: Review."

Review your settings and click on "Create user."

Once the user is created, note down the access key ID and secret access key provided. These are your Git credentials.

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

Congratulations! You've successfully set up a CodeCommit repository, configured GitCredentials, cloned the repository locally, added a new file, committed changes, and pushed them to CodeCommit. This lays a solid foundation for building our CI/CD pipeline on AWS.

Stay tuned for Part 2, where we'll delve into integrating CodeBuild and CodeDeploy into our pipeline to automate build and deployment processes. Happy coding! ๐Ÿš€ โ˜๏ธ

I'm confident that this article will prove to be valuable, helping you discover new insights and learn something enriching .

thank you : )

ย