AWS 给出错误“服务:AmazonECS,代码:ClientException,消息:容器“前端”的设置无效。必须至少指定“内存”或“内存保留”之一” 下面是 dockerrun.aws.json
{
"AWSEBDockerrunVersion": 2,
"containerDefinitions": [
{
"name": "frontend",
"image": "abc/frontend",
"memory": 128,
"hostname": "frontend",
"essential": true
},
{
"name": "server",
"image": "abc/"server",
"memory": 128,
"hostname": ""server",
"essential": true
}
],
"links": ["frontend", "server"],
"memory": 128
}
tl;dr - 如果使用 Terraform ECS 模块,请使用 memory_reservation 而不是 memoryReservation
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#container_definitions记录的container_description字段不匹配
内存预留 |类型:整数|必填:否以及官方 ECS 模块
https://registry.terraform.io/modules/terraform-aws-modules/ecs/aws/latest/submodules/container-definition?tab=inputs
内存_预留编号 描述:为容器保留的内存软限制(以 MiB 为单位)。当系统内存严重争用时,Docker 会尝试将容器内存保持在这个软限制内。但是,您的容器可以在需要时消耗更多内存,最多可达使用在代码中确认为
memory
参数指定的硬限制(如果适用),或容器实例上的所有可用内存 默认值:空
variable "memory_reservation" {
description = "The soft limit (in MiB) of memory to reserve for the container. When system memory is under heavy contention, Docker attempts to keep the container memory to this soft limit. However, your container can consume more memory when it needs to, up to either the hard limit specified with the `memory` parameter (if applicable), or all of the available memory on the container instance"
type = number
default = null
}