简体   繁体   English

将Git Repo直接镜像到AWS CodeCommit

[英]Mirror a Git Repo directly to AWS CodeCommit

I want to create a backup of one fo my Git Repository and save it to AWS CodeCommit. 我想在我的Git Repository中创建一个备份并将其保存到AWS CodeCommit。 I don't want to include the use of my local machine. 我不想包括使用我的本地机器。 Can anyone tell me how can I do it directly or through AWS Lambda? 任何人都可以告诉我如何直接或通过AWS Lambda进行此操作?

I just started searching for the answer to this very question. 我刚开始寻找这个问题的答案。 Before I post some of my preliminary data have you found a solution to this? 在我发布一些初步数据之前,您是否找到了解决方案?

Here is what I have found so far: 这是我到目前为止所发现的:

I successfully used the mirror feature to automatically pull a GitHub Repository into GitLab using the mirror feature offered by GitLab.com. 我成功地使用镜像功能,使用GitLab.com提供的镜像功能自动将GitHub存储库拉入GitLab。

I also found https://github.com/lambci/lambci which is serverless CI and looks promising. 我还发现https://github.com/lambci/lambci这是无服务器CI,看起来很有前景。

I believe the answer lies in a combination of AWS SNS Topic monitoring of Webhooks (GitLab and others) and pass the response to Lambda which spins up an instance which has either git or jgit to run the command, look through the LambCI Repository for details. 我相信答案在于对Webhooks(GitLab和其他人)的AWS SNS主题监控的组合,并将响应传递给Lambda,Lambda会旋转一个具有git或jgit的实例来运行命令,查看LambCI存储库以获取详细信息。

The only problem with this solution is that the AWS Lambda instance will clone the mirrored repository to its local storage and then push to AWS Code Commit and this will be repeated each time an instance gets started so for LARGE repositories or VERY ACTIVE repositories this may not be a good idea and you would be better off spinning up a nano EC2 instance with a CRON job to mirror the repository to AWS Code Commit. 此解决方案的唯一问题是AWS Lambda实例将镜像存储库克隆到其本地存储,然后推送到AWS Code Commit,每次实例启动时都会重复这一过程,因此对于LARGE存储库或VERY ACTIVE存储库,这可能不会这是一个好主意,你最好用一个CRON作业来启动nano EC2实例,以便将存储库镜像到AWS Code Commit。

It seems migrating directly from Github to AWS Code-commit is not available in the AWS documentation. 似乎AWS文档中没有直接从Github迁移到AWS Code-commit。 The following links have some scripts that can do the migration using a local machine. 以下链接包含一些可以使用本地计算机进行迁移的脚本。

Please check: 请检查:

http://www.paul-kearney.com/2015/09/migrating-from-github-to-aws-codecommit.html http://www.paul-kearney.com/2015/09/migrating-from-github-to-aws-codecommit.html

https://gist.github.com/paulkearney/6042561c56654a15af3c https://gist.github.com/paulkearney/6042561c56654a15af3c

AWS Quickstart provide a solution that copies your repo to s3 using lambda and webhooks. AWS快速入门提供了一种解决方案 ,可使用lambda和webhook将您的仓库复制到s3。

This solution could quite easily be modified to copy to CodeCommit rather than s3. 可以很容易地修改此解决方案以复制到CodeCommit而不是s3。

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM