View definition

(ContainerDefinition).Cpu

Defined in github.com/aws/aws-sdk-go/service/ecs/api.go

Description

The number of cpu units reserved for the container. A container instance has 1,024 cpu units for every CPU core. This parameter specifies the minimum amount of CPU to reserve for a container, and containers share unallocated CPU units with other containers on the instance with the same ratio as their allocated amount. This parameter maps to CpuShares in the Create a container (https://docs.docker.com/reference/api/docker_remote_api_v1.23/#create-a-container) section of the Docker Remote API (https://docs.docker.com/reference/api/docker_remote_api_v1.23/) and the --cpu-shares option to docker run (https://docs.docker.com/reference/commandline/run/).

You can determine the number of CPU units that are available per EC2 instance

type by multiplying the vCPUs listed for that instance type on the Amazon EC2 Instances (http://aws.amazon.com/ec2/instance-types/) detail page by 1,024.

For example, if you run a single-container task on a single-core instance

type with 512 CPU units specified for that container, and that is the only task running on the container instance, that container could use the full 1,024 CPU unit share at any given time. However, if you launched another copy of the same task on that container instance, each task would be guaranteed a minimum of 512 CPU units when needed, and each container could float to higher CPU usage if the other container was not using it, but if both tasks were 100% active all of the time, they would be limited to 512 CPU units.

The Docker daemon on the container instance uses the CPU value to calculate the relative CPU share ratios for running containers. For more information, see CPU share constraint (https://docs.docker.com/reference/run/#cpu-share-constraint) in the Docker documentation. The minimum valid CPU share value that the Linux kernel allows is 2; however, the CPU parameter is not required, and you can use CPU values below 2 in your container definitions. For CPU values below 2 (including null), the behavior varies based on your Amazon ECS container agent version:

Agent versions less than or equal to 1.1.0: Null and zero CPU values

are passed to Docker as 0, which Docker then converts to 1,024 CPU shares. CPU values of 1 are passed to Docker as 1, which the Linux kernel converts to 2 CPU shares.

Agent versions greater than or equal to 1.2.0: Null, zero, and CPU values

of 1 are passed to Docker as 2.

Cpu is referenced in 2 repositories

github.com/Clever/mesos-visualizer github.com/jhspaybar/ecs_state