AWS Lambda 容器镜像支持与 Fargate [英] AWS Lambda Container Image Support Vs Fargate

查看:24
本文介绍了AWS Lambda 容器镜像支持与 Fargate的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在评估一种使用 Docker 容器的解决方案.既然 lambda 也支持容器镜像,这也属于我的考虑范围.

I'm evaluating a solution approach using Docker containers. Now that lambda is also supporting container images this falls in my consideration too.

我根据以下因素进行评估

I'm evaluating based on the following factors

  1. 2 项服务的定价模型
  2. 冷启动问题
  3. 轻松将 Lamda 与其他 AWS 服务集成
  4. 使用 docker 容器轻松进行离线开发(我认为现在没有那么重要了)

在这 2 项服务之间我还需要考虑任何其他因素吗?

Any other factor I need to consider between the 2 services?

推荐答案

虽然这两个服务现在都允许您运行 Docker 镜像,但它们的目标应用程序类型不同.

Although both services allow you to run Docker images now, they both have different application types they target.

通常,您希望 Docker 容器运行一段时间,而不仅仅是几秒钟.此外,您通常会拥有整体"Docker 映像中的应用程序.

Typically, you want a Docker container to run for while and not just a few seconds. Furthermore, you often would have the "whole" application in a Docker image.

Lambda 为小任务而非整个应用程序(它们称为 Lambda 函数)提供短期运行计算能力(几秒到几分钟).因此,使用您的指标"比较它们很重要.可能不是正确的方法.

Lambda offers you short running compute power (seconds to minutes) for small tasks, not a whole application (they are called Lambda functions). So comparing them using your "metrics" might not be the right approach.

首先,您需要了解您希望容器运行多长时间.如果答案超过 900 秒,则无需将 Fargate 与 AWS Lambda 进行比较,因为 Lambda 最多只能运行 900 秒.

First, you need to find out for how long you want your containers to run. If the answer is longer than 900 seconds, you don't need to compare Fargate to AWS Lambda, since Lambda can only run for a maximum of 900 seconds.

其次,您需要检查什么您实际上想要在容器中运行.正如我之前所说,Lambda 是为小型、短期运行的功能而设计的,而不是托管"功能.整个应用程序(例如带有 Node/Rails/Django 应用程序的 Web 服务器).如果您想在 Lambda 上运行整个应用程序,则需要对其进行分解.S3 等上的静态文件,以及带有 AWS API Gateway 和 AWS Lambda 的后端 API.

Second, you need to check what you actually want to run in the container. As I said before, Lambdas are made for small, short running functions, not "hosting" whole applications (e.g. web servers with Node/Rails/Django apps). If you want to run a whole application on Lambda, you would need to decompose it. Static files on S3 etc., and backend API with AWS API Gateway and AWS Lambda.

也就是说,如果您真的希望您的容器运行时间少于 900 秒并想在两者之间进行比较,那么这里还有一些想法:

That said, if you really want your containers to run less than 900s and want to compare between the two, then here are a few more ideas:

  1. 可用资源量(内存、vCPU)
  2. 易于部署(取决于您的开发实践)
  3. 它们的测试效果如何?
  4. 您的团队对这两种技术的熟悉程度如何?
  5. 安全模型的差异?保护起来有多容易?

其中一些在很大程度上取决于您的经验、团队和实践,但应该考虑在内.

Some of those depend heavily on your experience, team and your practices, but should be factored in.

这篇关于AWS Lambda 容器镜像支持与 Fargate的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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