DEV Community

Udoh Deborah
Udoh Deborah

Posted on

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

Tools Involved in the Pipeline

Over the next 4 days, you’ll be learning and working with:
• AWS CodeCommit → Source control for managing your Git repositories.
• AWS CodeBuild → Builds and tests your code in the pipeline.
• AWS CodeDeploy → Deploys applications automatically to your compute resources.
• AWS CodePipeline → The orchestrator that ties everything together.
• Amazon S3 → Used for artifact storage.

What is CodeCommit?

• AWS CodeCommit is a fully managed source control service that works just like GitHub/GitLab but within AWS.
• It lets you store, manage, and version code securely.
• Supports Git commands (clone, push, pull).
• Integrates with IAM for authentication and fine-grained permissions.
• Useful for collaboration, compliance, and integration with the rest of your AWS CI/CD stack.
Enter fullscreen mode Exit fullscreen mode

Prerequisites
1. Git installed on your machine.
2. AWS CLI v2 installed and configured (aws configure) with an IAM user/role that has CodeCommit permissions.
3. An IAM user (or role) that can access CodeCommit (attach AWSCodeCommitPowerUser or appropriate fine-grained policy). 

TASK 01 — Create a CodeCommit repo & connect from local

A — Create the repository

Console (quick):
1. Sign in to the AWS console → Services → CodeCommit → Create repository. Give it a name and description and create it. 

aws codecommit create-repository \
  --repository-name MyDemoRepo \
  --repository-description "Day50 CI/CD demo"

Enter fullscreen mode Exit fullscreen mode

That returns JSON with the repo metadata.

B — Choose an authentication method (pick one)

Option 1 — HTTPS using IAM Git credentials (static username/password)
1. In AWS Console → IAM → Users → select your IAM user → Security credentials tab → under HTTPS Git credentials for AWS CodeCommit click Generate.
2. Save the generated username/password securely (you’ll use them when Git prompts).
This is simplest for personal dev machines. 

Option 2 — HTTPS using the AWS CLI credential helper (recommended for AWS profiles / instance roles)
1. Make sure aws configure is set (or you have an instance/profile with permissions).
2. Tell Git to use the AWS credential helper:

git config --global credential.helper '!aws codecommit credential-helper $@'
git config --global credential.UseHttpPath true
Enter fullscreen mode Exit fullscreen mode

With this the AWS CLI (or instance role) provides credentials to Git so you do not need static git username/password. 

Option 3 — git-remote-codecommit (useful for federated/SSO/temporary creds) — see docs if you use SSO or temporary credentials. 

C — Clone the (new/empty) repository

Get the clone URL from the CodeCommit console (or use the pattern below). Then:

If you want to clone an empty repo (console URL):

git clone https://git-codecommit.<region>.amazonaws.com/v1/repos/<repo-name> my-repo
cd my-repo
Enter fullscreen mode Exit fullscreen mode

Replace and with your values. 

(If you used git-remote-codecommit you may copy the GRC URL from the console instead.)

TASK 02 — Add a file locally, commit, push to CodeCommit

Choose the scenario that fits you:

If you cloned the empty repo (you are inside my-repo)

# create a file
echo# create a file
echo "# Day50 Repo" > README.md

# stage, commit
git add README.md
git commit -m "chore: add README for Day50"

# push (uses whichever auth method you configured)
git push origin main            # or 'master' depending on your default branch
# if push fails because branch doesn't exist remotely:
git push -u origin main "# Day50 Repo" > README.md

Enter fullscreen mode Exit fullscreen mode

If you started with a local repo and want to add CodeCommit as the remote

# inside your local project dir
git init
git add .
git commit -m "chore: initial commit"

# make sure branch name is 'main' (optional)
git branch -M main

# add CodeCommit remote (replace placeholders)
git remote add origin https://git-codecommit.<region>.amazonaws.com/v1/repos/<repo-name>

# push up
git push -u origin main

Enter fullscreen mode Exit fullscreen mode

(If you used git clone earlier you can skip the remote add part.) 

Top comments (0)