指定在AWS CDK中用于Fargate的所需CPU。

huangapple go评论48阅读模式
英文:

Specifying the desired CPU for Fargate in AWS CDK

问题

我的团队正在使用Fargate来扩展我们的服务。

我们想要使用Graviton,但我不确定如何指定特定的CPU类型。例如,如果我认为T4g是可以管理工作负载的实例,我该如何做?

到目前为止,我在CDK中指定CPU实例最接近的方法是通过在runtimePlatform的cpuArchitecture属性中指定ARM64。

更广泛地说,AWS是如何决定使用哪种实例类型的?显然,实例必须在该地区可用,但我想知道在未指定默认值或仅提供架构时,AWS如何设置默认值或使用哪种实例。

以下是迄今为止的Fargate任务定义。

const taskdef = new ecs.FargateTaskDefinition(this, `mytask`, {
   taskRole: myRole,
   cpu: 512,
   memoryLimitMiB: 1024,
   runtimePlatform: {
        cpuArchitecture: CpuArchitecture.ARM64
   }
});

但显然,这并没有让我对将实际使用的CPU实例有更多了解。

英文:

my team is using Fargate to scale our service.

We'd like to use Graviton but I'm not sure how to specify specific CPU types. For example, if I think T4g is the instance that would manage the workload how can I do this?

So far the closest I've got to specify CPU instance in CDK is by specifying the the cpuArchitecture property in runtimePlatform to ARM64.

More broadly speaking, how does AWS decide which instance type to use? Obviously the instance has to be available in the region but I'm curious how AWS sets default values when not specified or what instance to use when it's only given an architecture.

Here's the Fargate task definition so far.

const taskdef = new ecs.FargateTaskDefinition(this, `mytask`, {
   taskRole: myRole,
   cpu: 512,
   memoryLimitMiB: 1024,
   runtimePlatform: {
        cpuArchitecture: CpuArchitecture.ARM64
   }
});

But obviously this doesn't give me much insight into which cpu instance will actually be used.

答案1

得分: 2

在Fargate中没有"实例类型"。Fargate的整个目的是AWS为您管理底层的EC2实例,这样您甚至不需要考虑它们。您无法看到运行您的Fargate容器的EC2实例。

使用Fargate,您只需指定要保留的任务的CPU和RAM,然后Amazon会找到具有相应CPU和RAM可用的服务器,并部署您的任务到该服务器上。

您已经指定了有关Fargate任务的CPU要求的所有内容。您已经为CPU值指定了512,这为您的任务保留了底层服务器的0.5个CPU核心,并且您还指定了您的容器是构建用于运行在ARM架构上的,因此Amazon将部署您的任务到具有Graviton CPU而不是Intel CPU的服务器上。

英文:

There are no "instance types" in Fargate. The whole point of Fargate is that AWS manages the underlying EC2 instances for you, so that you don't even have to think about them. You have no visibility into what EC2 instances are running your Fargate containers.

With Fargate you simply specify the CPU and RAM you want to reserve for your task, and Amazon finds a server with that amount of CPU and RAM available, and deploys your task to it.

You have already specified everything you can regarding the CPU requirements for your Fargate task. You have specified 512 for the CPU value, which reserves 0.5 CPU cores on the underlying server for your task, and you have specified that your container(s) were built to run on ARM architecture, so Amazon will deploy your task to a server with a Graviton CPU instead of an Intel CPU.

huangapple
  • 本文由 发表于 2023年2月24日 06:08:43
  • 转载请务必保留本文链接:https://go.coder-hub.com/75550819.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定