DEV Community

GargeeBhatnagar for AWS Community Builders

Posted on

Replication of Repo Data with Existing Commits to Another Repo Using Remote Origin

“ I have checked the documents of AWS to resolve the issue of replicating one repo to another repo from the command line. So I got git remote origin as a solution. Pricing of solution depends on codecommit and ec2 instance cost.”

AWS Codecommit is a version control service hosted by AWS that you can use to privately store and manage assets in the cloud.

In this post, you will get to know how to do replication of repo data with existing commits to another repo using remote origin. Here I have used an ec2 server, iam role and codecommit repositories for replication of repo data with commits history to another repo using git remote origin.

Prerequisites

You’ll need an AWS CodeCommit Repositories for this post. Getting started with AWS CodeCommit provides instructions on how to create a codecommit repository. For this blog, I assume that I have two codecommit repositories created.

Architecture Overview

Image description
The architecture diagram shows the overall deployment architecture with data flow, amazon ec2, git remote origin commands and aws codecommit repos.

Solution overview

The blog post consists of the following phases:

  1. Create EC2 Instance and IAM Role. Run of Commands for Replication of One Repo Data with Commits to Another Repo
  2. Output of Replicated Data and Commits from One Repo to Another Repo

I have two codecommit repositories and one repo “testrepo-1” contains data with commits history as below →

Image description

Image description

Image description

Image description

Phase 1: Create EC2 Instance and IAM Role. Run of Commands for Replication of One Repo Data with Commits to Another Repo

  1. Launch of EC2 Instance and Creation of IAM role. Open the EC2 Connect console of instance, run the git commands to change the remote origin of the repository and replicate the data with commits of one repo to another repo.

Image description

Image description

Image description

Image description

Phase 2: Output of Replicated Data and Commits from One Repo to Another Repo

Image description

Image description

Image description

Clean-up

Delete EC2 Instance, IAM Role and CodeCommit Repository.

Pricing

I review the pricing and estimated cost of this example.

Cost of EC2 Instance = $0.09

Cost of CodeCommit = $0.00 for first 5 CodeCommit users = $0.0

Total Cost = $(0.09 + 0.0) = $0.09

Summary

In this post, I showed “how to do replication of repo data with existing commits to another repo using remote origin”.

For more details on AWS CodeCommit, Checkout Get started AWS CodeCommit, open the AWS CodeCommit console. To learn more, read the AWS CodeCommit documentation.

Thanks for reading!

Connect with me: Linkedin
Image description

Top comments (0)