I am currently working on a task which should take a backup of all AWS Codecommit repositories (around 60 repositories at the moment) and place them in an S3 bucket located in another AWS account.
I have googled it to find out the possibilities around this but found nothing that best suites my requirement.
1.) Considered using Code Pipeline:
We can configure AWS CodePipeline to use a branch in an AWS CodeCommit
repository as the source stage for our code. In this way, when you make
changes to your selected branch in CodePipeline, an archive of the
repository at the tip of that branch will be delivered to your CodePipeline
bucket.
But, I had to neglect this option as it could be applied only to a
particular branch of a repository whereas I want a backup for 60
repositories all at a time.
2.) Considered doing it using simple git command which clones the git repositories, placing the cloned stuff into a folder and sending them to S3 bucket in another account.
I had to neglect this because it complicates my process when a new git
repository is created where I need to manually go to AWS account and get the
url of that repo to clone.
So, I want to know if there is a good option to automatically backup Codecommit repositories in S3 located in a different AWS account. If something in any of the repos changes, it should automatically trigger that changed part and move it to S3.