如何使用AWS Lambda安装Git? [英] How do I install Git using AWS Lambda?

查看:175
本文介绍了如何使用AWS Lambda安装Git?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在代码提交存储库中有代码,我正在编写一个lambda函数来为代码提交存储库的每次签入(事件)构建代码。

I have code in Code commit repository, I am writing a lambda function to build the code for every check-in (event) to the code commit repo.

我无法安装git,因此无法克隆存储库。

我该怎么做。

推荐答案

正如其他人提到的那样,在lambda上安装git真的很困难,或者完全不可能。我在重塑lambda和step函数时做了一个会议,并花了一些时间尝试使其工作。我放弃。我最近发现的一种替代方法是对节点或python或您使用的任何语言使用git库之一。但这仍然不是一个好主意,需要维护该功能时会引起痛苦。

As the others have mentioned installing git on lambda is either really hard or totally impossible. I did a session at reinvent about lambda and step functions and spent some time trying to get it to work. I gave up. An alternative I found more recently is to use one of the git libraries for node or python or whatever language you are using. But this is still a bad idea and will cause pain when you need to maintain the function.

原来还有另外一种选择,但看起来很乱:在AWS Lambda中运行'git'

It turns out another alternative is here but looks messy: Running 'git' in AWS lambda

使用CodeBuild是一个更好的主意。它是一个在AWS上构建的系统,可以完成您想要的任何事情。使用Docker,您可以提供自己的Docker映像。我进行了多阶段构建,以创建尽可能最小的GatsbyJS图像。现在的缺点是,配置需要30秒(没有自定义映像需要2分钟)。 Plus CodeBuild每月(永久)每月有100分钟的免费分钟。如果这是个人情况,则可以完全覆盖您。

Using CodeBuild is a much better idea. Its a build system on AWS that will do anything you want it to. Uses Docker and you can supply your own docker image. I did a multi-stage build to create the smallest possible GatsbyJS image. Now the downside is that it takes 30 seconds to provision (it took closer to 2 minutes without the custom image). Plus CodeBuild has 100 free minutes per month, every month for ever. If this is a personal scenario, this could cover you completely.

如果您不介意混合使用云,还可以使用Google的Cloud Container Builder。它说它是用于构建docker映像的,但是您可以将其用于所需的任何东西。每天前120分钟都是免费的。因此绝对值得研究的一项很棒的服务。没有什么能阻止您混合来自不同云的服务。

If you don’t mind mixing the clouds, also look into Google’s Cloud Container Builder. It says its for building docker images, but you can use it for anything you need. And the first 120 minutes EVERY day are free. So definitely a cool service to look into. There is nothing stopping you from mixing services from different clouds.

我在reInvent的会议使用codebuild,lambda和许多其他服务来使用来自树莓派和一项服务,可以识别正在显示的幻灯片。它工作得很漂亮。用谷歌搜索SRV335,如果您有兴趣在运行中使用lambda来查看代码构建,应该找到它

My session at reInvent used codebuild, lambda and a lot of other services to live blog the session using images from a raspberry pi and a service to recognize which slide was being shown. It worked beautifully. Do a google search for SRV335 and you should find it if you are interested in seeing codebuild with lambda in action

这篇关于如何使用AWS Lambda安装Git?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆