aws::ecs-task-definition¶
Create an ECS task definition.
Example¶
aws::ecs-task-definition ecs-task-definition-ec2-example
family: "ecs-task-definition-ec2-example"
requires-compatibilities: ["EC2"]
network-mode: "bridge"
task-role: $(aws::iam-role ecs-task-role-example)
execution-role: $(aws::iam-role ecs-task-execution-role-example)
cpu: 512
memory: 2048
container-definition
name: "ecs-container-definition-example"
image: "ecs-container-definition-example"
cpu: 256
memory: 2048
memory-reservation: 1024
links: ["ecs-container-definition-example-2"]
port-mapping
container-port: 80
host-port: 210
protocol: tcp
end
entry-point: ["executable", "param1", "param2"]
command: ["cparam1","cparam2"]
environment: {
VAR: "value"
}
mount-point
source-volume: "ecs-volume-example"
container-path: "/example-host-volume-path"
read-only: false
end
volume-from
source-container: "ecs-container-definition-example-2"
read-only: false
end
linux-parameters
init-process-enabled: true
shared-memory-size: 128
capabilities
add: ["AUDIT_CONTROL", "SYS_ADMIN", "SYS_TTY_CONFIG"]
drop: ["BLOCK_SUSPEND", "SETPCAP", "WAKE_ALARM"]
end
device
host-path: "/example-device-host-path"
container-path: "/example-device-container-path"
permissions: ["read", "write"]
end
tmpfs
container-path: "/example-tmpfs-path"
size: 64
mount-options: ["exec", "async", "remount"]
end
max-swap: 128
swappiness: 60
end
extra-host
hostname: "example-extra-hostname"
ip-address: "40.40.40.40"
end
ulimit
name: "core"
soft-limit: 256
hard-limit: 512
end
log-configuration
log-driver: "syslog"
options: {
example-option: "example-value"
}
end
health-check
command: [ "CMD-SHELL", "curl -f http://localhost/ || exit 1" ]
interval: 30
timeout: 5
retries: 3
start-period: 20
end
system-control
namespace: "net.ipv4.ip_forward"
value: "1"
end
resource-requirement
type: "GPU"
value: "4"
end
resource-requirement
type: "InferenceAccelerator"
value: "ecs-inference-accelerator-example"
end
firelens-configuration
type: "fluentd"
options: {
enable-ecs-log-metadata: "true"
}
end
essential: true
start-timeout: 180
stop-timeout: 30
hostname: "example-hostname"
user: "0:example-group"
working-directory: "/example-working-directory"
disable-networking: false
privileged: true
readonly-root-filesystem: false
dns-servers: ["8.8.8.8"]
interactive: true
pseudo-terminal: true
docker-labels: {
example-label: "example-value"
}
end
container-definition
name: "ecs-container-definition-example-2"
image: "ecs-container-definition-example-2"
cpu: 256
memory: 2048
memory-reservation: 1024
essential: false
depends-on
container-name: "ecs-container-definition-example"
condition: "HEALTHY"
end
log-configuration
log-driver: "awsfirelens"
options: {
example-option: "example-value"
}
end
end
volume
name: "ecs-volume-example"
docker-volume-configuration
scope: "shared"
autoprovision: true
driver: "local"
driver-opts: {
example-option: "example-value"
}
labels: {
example-label: "example-value"
}
end
end
inference-accelerator
device-name: "ecs-inference-accelerator-example"
device-type: "eia1.medium"
end
placement-constraint
type: "memberOf"
expression: "runningTasksCount == 1"
end
pid-mode: "host"
ipc-mode: "host"
tags: {
Name: "ecs-task-definition-ec2-example"
}
end
Attributes¶
Attribute | Description |
---|---|
family | The name shared among all revisions of a task definition. Must be a string 1 to 255 characters long containing letters, numbers, and hyphens. Valid values satisfy the regex: [[-a-zA-Z0-9]{1,255}] . (Required) |
task-role | The IAM role that containers in this task can assume. All containers in this task are granted the permissions that are specified in this role. |
execution-role | The task execution role that the Amazon ECS container agent and the Docker daemon can assume. |
requires-compatibilities set | The launch type required by the task. Valid values are EC2 and FARGATE . |
container-definition list subresource | A list of container definitions that describes the different containers that make up the task. (Required) (Required)
|
volume list subresource | A list of volume definitions that containers in the task may use.
|
placement-constraint list subresource | An array of placement constraint objects to use for the task. A maximum of 10 constraints are allowed per task (this limit includes constraints in the task definition and those specified at runtime).
|
network-mode | The Docker networking mode to use for the containers in the task. The |
cpu | The number of CPU units used by the task. Valid values range from |
memory | The amount of memory (in MiB) used by the task. If |
pid-mode | The process namespace to use for the containers in the task. If |
ipc-mode | The IPC resource namespace to use for the containers in the task. If |
proxy-configuration subresource | The proxy configuration for the task definition.
|
inference-accelerator list subresource | The Elastic Inference accelerators to use for the containers in the task. Maximum allowed items are
|
tags map | The metadata applied to the task definition. Each tag consists of a key and an optional value. Up to 50 tags per resource are allowed. The maximum character length is 128 for keys and 256 for values.
Tags may not be prefixed with |
Outputs¶
Attribute | Description |
---|---|
revision | A version number of a task definition in a When you register a task definition for the first time, the |
arn | The full Amazon Resource Name (ARN) of the task definition. |