Incorrect CPU or memory settings for AWS Fargate tasks can prevent containers from starting or cause insufficient or imbalanced resource allocation. This can lead to service downtime and degraded availability.
This rule checks AWS::ECS::Service resources with LaunchType set to FARGATE and their associated AWS::ECS::TaskDefinition container definitions:
ContainerDefinitions[].Cpu must be one of 256, 512, 1024, 2048, or 4096.
Memory must match allowed values per CPU:
For Cpu=256, memory must be 512, 1024, or 2048.
For Cpu=512, memory must be in the range 1024–4095.
For Cpu=1024, memory must be in the range 2048–8191.
For Cpu=2048, memory must be in the range 4096–16383.
For Cpu=4096, memory must be in the range 8192–30719.
Resources missing these properties, with Cpu outside the allowed set, with Memory outside the mapped values, or (for non-256 CPU) with Memory not a multiple of 1024 will be flagged.