Amazon ECS Tasks API

Operations for running and managing ECS tasks

Documentation

Specifications

Schemas & Data

Other Resources

OpenAPI Specification

amazon-ecs-tasks-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Amazon ECS Amazon Elastic Container Service (ECS) Capacity Providers Tasks API
  description: Amazon Elastic Container Service (Amazon ECS) is a fully managed container orchestration service that makes it easy to deploy, manage, and scale containerized applications. The Amazon ECS API uses an RPC model where all actions are routed to a single endpoint via POST with an X-Amz-Target header specifying the action. This specification models the core ECS resource operations for clusters, services, tasks, and task definitions.
  version: '2014-11-13'
  contact:
    name: Amazon Web Services
    url: https://aws.amazon.com/ecs/
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
  x-apisguru-categories:
  - cloud
  x-logo:
    url: https://aws.amazon.com/favicon.ico
  x-origin:
  - format: openapi
    url: https://docs.aws.amazon.com/AmazonECS/latest/APIReference/Welcome.html
    version: '3.1'
servers:
- url: https://ecs.{region}.amazonaws.com
  description: Amazon ECS regional endpoint
  variables:
    region:
      default: us-east-1
      description: AWS region
      enum:
      - us-east-1
      - us-east-2
      - us-west-1
      - us-west-2
      - eu-west-1
      - eu-west-2
      - eu-west-3
      - eu-central-1
      - eu-north-1
      - ap-southeast-1
      - ap-southeast-2
      - ap-northeast-1
      - ap-northeast-2
      - ap-south-1
      - sa-east-1
      - ca-central-1
security:
- aws_sig_v4: []
tags:
- name: Tasks
  description: Operations for running and managing ECS tasks
  externalDocs:
    url: https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_RunTask.html
paths:
  /#X-Amz-Target=AmazonEC2ContainerServiceV20141113.RunTask:
    post:
      operationId: RunTask
      summary: Amazon Ecs Run a New Task
      description: Starts a new task using the specified task definition. You can specify the cluster, launch type, network configuration, and overrides.
      tags:
      - Tasks
      externalDocs:
        url: https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_RunTask.html
      parameters:
      - $ref: '#/components/parameters/X-Amz-Target'
      requestBody:
        required: true
        content:
          application/x-amz-json-1.1:
            schema:
              $ref: '#/components/schemas/RunTaskRequest'
            examples:
              RuntaskRequestExample:
                summary: Default RunTask request
                x-microcks-default: true
                value:
                  taskDefinition: example_value
                  cluster: example_value
                  count: 10
                  launchType: EC2
                  capacityProviderStrategy:
                  - capacityProvider: example_value
                    weight: 10
                    base: 10
                  platformVersion: example_value
                  networkConfiguration:
                    awsvpcConfiguration:
                      subnets: {}
                      securityGroups: {}
                      assignPublicIp: ENABLED
                  overrides:
                    containerOverrides:
                    - {}
                    cpu: example_value
                    memory: example_value
                    taskRoleArn: example_value
                    executionRoleArn: example_value
                    inferenceAcceleratorOverrides:
                    - {}
                  placementConstraints:
                  - type: distinctInstance
                    expression: example_value
                  placementStrategy:
                  - type: random
                    field: example_value
                  group: example_value
                  startedBy: example_value
                  tags:
                  - key: example_value
                    value: example_value
                  enableECSManagedTags: true
                  enableExecuteCommand: true
                  propagateTags: TASK_DEFINITION
                  clientToken: example_value
      responses:
        '200':
          description: Task started successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RunTaskResponse'
              examples:
                Runtask200Example:
                  summary: Default RunTask 200 response
                  x-microcks-default: true
                  value:
                    tasks:
                    - taskArn: example_value
                      clusterArn: example_value
                      taskDefinitionArn: example_value
                      containerInstanceArn: example_value
                      lastStatus: PROVISIONING
                      desiredStatus: RUNNING
                      cpu: example_value
                      memory: example_value
                      containers: {}
                      startedBy: example_value
                      version: 10
                      stoppedReason: example_value
                      stopCode: TaskFailedToStart
                      connectivity: CONNECTED
                      connectivityAt: 42.5
                      pullStartedAt: 42.5
                      pullStoppedAt: 42.5
                      executionStoppedAt: 42.5
                      createdAt: 42.5
                      startedAt: 42.5
                      stoppingAt: 42.5
                      stoppedAt: 42.5
                      group: example_value
                      launchType: EC2
                      platformVersion: example_value
                      platformFamily: example_value
                      capacityProviderName: example_value
                      availabilityZone: example_value
                      attachments: {}
                      healthStatus: HEALTHY
                      enableExecuteCommand: true
                      tags: {}
                      inferenceAccelerators: {}
                      attributes: {}
                    failures:
                    - arn: example_value
                      reason: example_value
                      detail: example_value
        '400':
          $ref: '#/components/responses/ClientError'
        '500':
          $ref: '#/components/responses/ServerError'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /#X-Amz-Target=AmazonEC2ContainerServiceV20141113.StartTask:
    post:
      operationId: StartTask
      summary: Amazon Ecs Start a Task on a Specific Container Instance
      description: Starts a new task from the specified task definition on the specified container instance or instances.
      tags:
      - Tasks
      externalDocs:
        url: https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_StartTask.html
      parameters:
      - $ref: '#/components/parameters/X-Amz-Target'
      requestBody:
        required: true
        content:
          application/x-amz-json-1.1:
            schema:
              type: object
              required:
              - taskDefinition
              - containerInstances
              properties:
                cluster:
                  type: string
                taskDefinition:
                  type: string
                  description: The family and revision or full ARN of the task definition.
                containerInstances:
                  type: array
                  description: The container instance IDs or ARNs to start the task on.
                  items:
                    type: string
                overrides:
                  $ref: '#/components/schemas/TaskOverride'
                startedBy:
                  type: string
                group:
                  type: string
                networkConfiguration:
                  $ref: '#/components/schemas/NetworkConfiguration'
                tags:
                  type: array
                  items:
                    $ref: '#/components/schemas/Tag'
                enableECSManagedTags:
                  type: boolean
                enableExecuteCommand:
                  type: boolean
                propagateTags:
                  type: string
                  enum:
                  - TASK_DEFINITION
                  - SERVICE
                  - NONE
            examples:
              StarttaskRequestExample:
                summary: Default StartTask request
                x-microcks-default: true
                value:
                  cluster: example_value
                  taskDefinition: example_value
                  containerInstances:
                  - example_value
                  overrides:
                    containerOverrides:
                    - name: Example Title
                      command: {}
                      environment: {}
                      environmentFiles: {}
                      cpu: 10
                      memory: 10
                      memoryReservation: 10
                      resourceRequirements: {}
                    cpu: example_value
                    memory: example_value
                    taskRoleArn: example_value
                    executionRoleArn: example_value
                    ephemeralStorage:
                      sizeInGiB: 10
                    inferenceAcceleratorOverrides:
                    - deviceName: example_value
                      deviceType: example_value
                  startedBy: example_value
                  group: example_value
                  networkConfiguration:
                    awsvpcConfiguration:
                      subnets:
                      - {}
                      securityGroups:
                      - {}
                      assignPublicIp: ENABLED
                  tags:
                  - key: example_value
                    value: example_value
                  enableECSManagedTags: true
                  enableExecuteCommand: true
                  propagateTags: TASK_DEFINITION
      responses:
        '200':
          description: Task started successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RunTaskResponse'
              examples:
                Starttask200Example:
                  summary: Default StartTask 200 response
                  x-microcks-default: true
                  value:
                    tasks:
                    - taskArn: example_value
                      clusterArn: example_value
                      taskDefinitionArn: example_value
                      containerInstanceArn: example_value
                      lastStatus: PROVISIONING
                      desiredStatus: RUNNING
                      cpu: example_value
                      memory: example_value
                      containers: {}
                      startedBy: example_value
                      version: 10
                      stoppedReason: example_value
                      stopCode: TaskFailedToStart
                      connectivity: CONNECTED
                      connectivityAt: 42.5
                      pullStartedAt: 42.5
                      pullStoppedAt: 42.5
                      executionStoppedAt: 42.5
                      createdAt: 42.5
                      startedAt: 42.5
                      stoppingAt: 42.5
                      stoppedAt: 42.5
                      group: example_value
                      launchType: EC2
                      platformVersion: example_value
                      platformFamily: example_value
                      capacityProviderName: example_value
                      availabilityZone: example_value
                      attachments: {}
                      healthStatus: HEALTHY
                      enableExecuteCommand: true
                      tags: {}
                      inferenceAccelerators: {}
                      attributes: {}
                    failures:
                    - arn: example_value
                      reason: example_value
                      detail: example_value
        '400':
          $ref: '#/components/responses/ClientError'
        '500':
          $ref: '#/components/responses/ServerError'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /#X-Amz-Target=AmazonEC2ContainerServiceV20141113.StopTask:
    post:
      operationId: StopTask
      summary: Amazon Ecs Stop a Running Task
      description: Stops a running task. Resources are cleaned up and the task transitions to STOPPED status.
      tags:
      - Tasks
      externalDocs:
        url: https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_StopTask.html
      parameters:
      - $ref: '#/components/parameters/X-Amz-Target'
      requestBody:
        required: true
        content:
          application/x-amz-json-1.1:
            schema:
              type: object
              required:
              - task
              properties:
                cluster:
                  type: string
                  description: The short name or full ARN of the cluster hosting the task.
                task:
                  type: string
                  description: The task ID or full ARN of the task to stop.
                reason:
                  type: string
                  description: An optional message to record why the task was stopped.
            examples:
              StoptaskRequestExample:
                summary: Default StopTask request
                x-microcks-default: true
                value:
                  cluster: example_value
                  task: example_value
                  reason: example_value
      responses:
        '200':
          description: Task stopped successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  task:
                    $ref: '#/components/schemas/Task'
              examples:
                Stoptask200Example:
                  summary: Default StopTask 200 response
                  x-microcks-default: true
                  value:
                    task:
                      taskArn: example_value
                      clusterArn: example_value
                      taskDefinitionArn: example_value
                      containerInstanceArn: example_value
                      overrides:
                        containerOverrides: {}
                        cpu: example_value
                        memory: example_value
                        taskRoleArn: example_value
                        executionRoleArn: example_value
                        inferenceAcceleratorOverrides: {}
                      lastStatus: PROVISIONING
                      desiredStatus: RUNNING
                      cpu: example_value
                      memory: example_value
                      containers:
                      - {}
                      startedBy: example_value
                      version: 10
                      stoppedReason: example_value
                      stopCode: TaskFailedToStart
                      connectivity: CONNECTED
                      connectivityAt: 42.5
                      pullStartedAt: 42.5
                      pullStoppedAt: 42.5
                      executionStoppedAt: 42.5
                      createdAt: 42.5
                      startedAt: 42.5
                      stoppingAt: 42.5
                      stoppedAt: 42.5
                      group: example_value
                      launchType: EC2
                      platformVersion: example_value
                      platformFamily: example_value
                      capacityProviderName: example_value
                      availabilityZone: example_value
                      attachments:
                      - {}
                      healthStatus: HEALTHY
                      enableExecuteCommand: true
                      tags:
                      - {}
                      ephemeralStorage:
                        sizeInGiB: 10
                      inferenceAccelerators:
                      - {}
                      attributes:
                      - name: Example Title
                        value: example_value
                        targetType: example_value
                        targetId: '500123'
        '400':
          $ref: '#/components/responses/ClientError'
        '500':
          $ref: '#/components/responses/ServerError'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /#X-Amz-Target=AmazonEC2ContainerServiceV20141113.DescribeTasks:
    post:
      operationId: DescribeTasks
      summary: Amazon Ecs Describe One or More Tasks
      description: Describes a specified task or tasks in a cluster.
      tags:
      - Tasks
      externalDocs:
        url: https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_DescribeTasks.html
      parameters:
      - $ref: '#/components/parameters/X-Amz-Target'
      requestBody:
        required: true
        content:
          application/x-amz-json-1.1:
            schema:
              type: object
              required:
              - tasks
              properties:
                cluster:
                  type: string
                  description: The short name or full ARN of the cluster hosting the tasks.
                tasks:
                  type: array
                  description: A list of up to 100 task IDs or full ARN entries.
                  items:
                    type: string
                  maxItems: 100
                include:
                  type: array
                  items:
                    type: string
                    enum:
                    - TAGS
            examples:
              DescribetasksRequestExample:
                summary: Default DescribeTasks request
                x-microcks-default: true
                value:
                  cluster: example_value
                  tasks:
                  - example_value
                  include:
                  - TAGS
      responses:
        '200':
          description: Tasks described successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  tasks:
                    type: array
                    items:
                      $ref: '#/components/schemas/Task'
                  failures:
                    type: array
                    items:
                      $ref: '#/components/schemas/Failure'
              examples:
                Describetasks200Example:
                  summary: Default DescribeTasks 200 response
                  x-microcks-default: true
                  value:
                    tasks:
                    - taskArn: example_value
                      clusterArn: example_value
                      taskDefinitionArn: example_value
                      containerInstanceArn: example_value
                      lastStatus: PROVISIONING
                      desiredStatus: RUNNING
                      cpu: example_value
                      memory: example_value
                      containers:
                      - {}
                      startedBy: example_value
                      version: 10
                      stoppedReason: example_value
                      stopCode: TaskFailedToStart
                      connectivity: CONNECTED
                      connectivityAt: 42.5
                      pullStartedAt: 42.5
                      pullStoppedAt: 42.5
                      executionStoppedAt: 42.5
                      createdAt: 42.5
                      startedAt: 42.5
                      stoppingAt: 42.5
                      stoppedAt: 42.5
                      group: example_value
                      launchType: EC2
                      platformVersion: example_value
                      platformFamily: example_value
                      capacityProviderName: example_value
                      availabilityZone: example_value
                      attachments:
                      - {}
                      healthStatus: HEALTHY
                      enableExecuteCommand: true
                      tags:
                      - {}
                      inferenceAccelerators:
                      - {}
                      attributes:
                      - {}
                    failures:
                    - arn: example_value
                      reason: example_value
                      detail: example_value
        '400':
          $ref: '#/components/responses/ClientError'
        '500':
          $ref: '#/components/responses/ServerError'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /#X-Amz-Target=AmazonEC2ContainerServiceV20141113.ListTasks:
    post:
      operationId: ListTasks
      summary: Amazon Ecs List Tasks
      description: Returns a list of tasks. You can filter by cluster, container instance, family, or service.
      tags:
      - Tasks
      externalDocs:
        url: https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ListTasks.html
      parameters:
      - $ref: '#/components/parameters/X-Amz-Target'
      requestBody:
        required: false
        content:
          application/x-amz-json-1.1:
            schema:
              type: object
              properties:
                cluster:
                  type: string
                  description: The short name or full ARN of the cluster.
                containerInstance:
                  type: string
                  description: The container instance ID or full ARN.
                family:
                  type: string
                  description: Filter by task definition family name.
                serviceName:
                  type: string
                  description: Filter by service name.
                desiredStatus:
                  type: string
                  enum:
                  - RUNNING
                  - PENDING
                  - STOPPED
                  description: Filter by desired task status.
                launchType:
                  type: string
                  enum:
                  - EC2
                  - FARGATE
                  - EXTERNAL
                startedBy:
                  type: string
                  description: Filter by the startedBy value.
                maxResults:
                  type: integer
                  description: Maximum number of results per page (1-100).
                nextToken:
                  type: string
                  description: Pagination token from a previous response.
            examples:
              ListtasksRequestExample:
                summary: Default ListTasks request
                x-microcks-default: true
                value:
                  cluster: example_value
                  containerInstance: example_value
                  family: example_value
                  serviceName: example_value
                  desiredStatus: RUNNING
                  launchType: EC2
                  startedBy: example_value
                  maxResults: 10
                  nextToken: example_value
      responses:
        '200':
          description: Tasks listed successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  taskArns:
                    type: array
                    items:
                      type: string
                  nextToken:
                    type: string
              examples:
                Listtasks200Example:
                  summary: Default ListTasks 200 response
                  x-microcks-default: true
                  value:
                    taskArns:
                    - example_value
                    nextToken: example_value
        '400':
          $ref: '#/components/responses/ClientError'
        '500':
          $ref: '#/components/responses/ServerError'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /#X-Amz-Target=AmazonEC2ContainerServiceV20141113.TagResource:
    post:
      operationId: TagResource
      summary: Amazon Ecs Tag an Ecs Resource
      description: Associates the specified tags to a resource with the specified resourceArn.
      tags:
      - Tasks
      externalDocs:
        url: https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_TagResource.html
      parameters:
      - $ref: '#/components/parameters/X-Amz-Target'
      requestBody:
        required: true
        content:
          application/x-amz-json-1.1:
            schema:
              type: object
              required:
              - resourceArn
              - tags
              properties:
                resourceArn:
                  type: string
                  description: The ARN of the resource to tag.
                tags:
                  type: array
                  items:
                    $ref: '#/components/schemas/Tag'
            examples:
              TagresourceRequestExample:
                summary: Default TagResource request
                x-microcks-default: true
                value:
                  resourceArn: example_value
                  tags:
                  - key: example_value
                    value: example_value
      responses:
        '200':
          description: Resource tagged successfully
          content:
            application/json:
              schema:
                type: object
              examples:
                Tagresource200Example:
                  summary: Default TagResource 200 response
                  x-microcks-default: true
                  value: {}
        '400':
          $ref: '#/components/responses/ClientError'
        '500':
          $ref: '#/components/responses/ServerError'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /#X-Amz-Target=AmazonEC2ContainerServiceV20141113.UntagResource:
    post:
      operationId: UntagResource
      summary: Amazon Ecs Remove Tags From an Ecs Resource
      description: Deletes specified tags from a resource.
      tags:
      - Tasks
      externalDocs:
        url: https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_UntagResource.html
      parameters:
      - $ref: '#/components/parameters/X-Amz-Target'
      requestBody:
        required: true
        content:
          application/x-amz-json-1.1:
            schema:
              type: object
              required:
              - resourceArn
              - tagKeys
              properties:
                resourceArn:
                  type: string
                  description: The ARN of the resource to untag.
                tagKeys:
                  type: array
                  items:
                    type: string
                  description: The keys of the tags to remove.
            examples:
              UntagresourceRequestExample:
                summary: Default UntagResource request
                x-microcks-default: true
                value:
                  resourceArn: example_value
                  tagKeys:
                  - example_value
      responses:
        '200':
          description: Tags removed successfully
          content:
            application/json:
              schema:
                type: object
              examples:
                Untagresource200Example:
                  summary: Default UntagResource 200 response
                  x-microcks-default: true
                  value: {}
        '400':
          $ref: '#/components/responses/ClientError'
        '500':
          $ref: '#/components/responses/ServerError'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /#X-Amz-Target=AmazonEC2ContainerServiceV20141113.ListTagsForResource:
    post:
      operationId: ListTagsForResource
      summary: Amazon Ecs List Tags for an Ecs Resource
      description: Lists the tags for the specified resource.
      tags:
      - Tasks
      externalDocs:
        url: https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ListTagsForResource.html
      parameters:
      - $ref: '#/components/parameters/X-Amz-Target'
      requestBody:
        required: true
        content:
          application/x-amz-json-1.1:
            schema:
              type: object
              required:
              - resourceArn
              properties:
                resourceArn:
                  type: string
                  description: The ARN of the resource to list tags for.
            examples:
              ListtagsforresourceRequestExample:
                summary: Default ListTagsForResource request
                x-microcks-default: true
                value:
                  resourceArn: example_value
      responses:
        '200':
          description: Tags listed successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  tags:
                    type: array
                    items:
                      $ref: '#/components/schemas/Tag'
              examples:
                Listtagsforresource200Example:
                  summary: Default ListTagsForResource 200 response
                  x-microcks-default: true
                  value:
                    tags:
                    - key: example_value
                      value: example_value
        '400':
          $ref: '#/components/responses/ClientError'
        '500':
          $ref: '#/components/responses/ServerError'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /#X-Amz-Target=AmazonEC2ContainerServiceV20141113.ExecuteCommand:
    post:
      operationId: ExecuteCommand
      summary: Amazon Ecs Execute a Command in a Running Container
      description: Runs a command remotely on a container within a task that is managed by Amazon ECS using AWS Systems Manager Session Manager.
      tags:
      - Tasks
      externalDocs:
        url: https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ExecuteCommand.html
      parameters:
      - $ref: '#/components/parameters/X-Amz-Target'
      requestBody:
        required: true
        content:
          application/x-amz-json-1.1:
            schema:
              type: object
              required:
              - command
              - interactive
              - task
              properties:
                cluster:
                  type: string
                container:
                  type: string
                  description: The name of the container to execute the command on. If not specified, the default container is used.
                command:
                  type: string
                  description: The command to run on the container.
                interactive:
                  type: boolean
                  description: Whether to run the command in interactive mode.
                task:
                  type: string
                  description: The task ID or full ARN of the task.
            examples:
              ExecutecommandRequestExample:
                summary: Default ExecuteCommand request
                x-microcks-default: true
                value:
                  cluster: example_value
                  container: example_value
                  command: example_value
                  interactive: true
                  task: example_value
      responses:
        '200':
          description: Command executed successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  clusterArn:
                    type: string
                  containerArn:
                    type: string
                  containerName:
                    type: string
                  interactive:
                    type: boolean
                  session:
                    type: object
                    properties:
                      sessionId:
                        type: string
                      streamUrl:
                        type: string
                      tokenValue:
                        type: string
                  taskArn:
                    type: string
              examples:
                Executecommand200Example:
                  summary: Default ExecuteCommand 200 response
                  x-microcks-default: true
                  value:
                    cluste

# --- truncated at 32 KB (49 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/amazon-ecs/refs/heads/main/openapi/amazon-ecs-tasks-api-openapi.yml