Amazon Fargate · Arazzo Workflow

Amazon Fargate Tear Down a Service

Version 1.0.0

Scale a service to zero, wait for it to drain, then delete it.

1 workflow 1 source API 1 provider
View Spec View on GitHub ComputeContainersECSEKSMicroservicesServerlessArazzoWorkflows

Provider

amazon-fargate

Workflows

teardown-service
Drain a service to zero tasks and then delete it.
Chains updateService (desiredCount 0), a describeServices drain poll, and deleteService.
3 steps inputs: cluster, service outputs: finalStatus, serviceArn
1
scaleToZero
Update the service desired count to zero so its tasks drain.
2
pollDrained
Poll DescribeServices until the running count reaches zero, re-entering while tasks are still draining.
3
deleteService
Delete the now-drained service from the cluster.

Source API Descriptions

Arazzo Workflow Specification

Raw ↑
arazzo: 1.0.1
info:
  title: Amazon Fargate Tear Down a Service
  summary: Scale a service to zero, wait for it to drain, then delete it.
  description: >-
    Safely decommissions a Fargate service. ECS requires a service to have zero
    running tasks before it can be deleted cleanly, so the workflow first
    updates the service desired count to zero, polls DescribeServices until the
    running count reaches zero, and then deletes the service. Each step inlines
    its AWS JSON 1.1 request and the X-Amz-Target action header so the teardown
    can be read and executed directly.
  version: 1.0.0
sourceDescriptions:
- name: servicesApi
  url: ../openapi/amazon-fargate-services-api-openapi.yml
  type: openapi
workflows:
- workflowId: teardown-service
  summary: Drain a service to zero tasks and then delete it.
  description: >-
    Chains updateService (desiredCount 0), a describeServices drain poll, and
    deleteService.
  inputs:
    type: object
    required:
    - cluster
    - service
    properties:
      cluster:
        type: string
        description: Name or ARN of the cluster hosting the service.
      service:
        type: string
        description: Name or ARN of the service to tear down.
  steps:
  - stepId: scaleToZero
    description: Update the service desired count to zero so its tasks drain.
    operationId: updateService
    parameters:
    - name: X-Amz-Target
      in: header
      value: AmazonEC2ContainerServiceV20141113.UpdateService
    requestBody:
      contentType: application/x-amz-json-1.1
      payload:
        cluster: $inputs.cluster
        service: $inputs.service
        desiredCount: 0
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      serviceArn: $response.body#/service/serviceArn
      desiredCount: $response.body#/service/desiredCount
  - stepId: pollDrained
    description: >-
      Poll DescribeServices until the running count reaches zero, re-entering
      while tasks are still draining.
    operationId: describeServices
    parameters:
    - name: X-Amz-Target
      in: header
      value: AmazonEC2ContainerServiceV20141113.DescribeServices
    requestBody:
      contentType: application/x-amz-json-1.1
      payload:
        cluster: $inputs.cluster
        services:
        - $inputs.service
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      runningCount: $response.body#/services/0/runningCount
      status: $response.body#/services/0/status
    onSuccess:
    - name: stillDraining
      type: goto
      stepId: pollDrained
      criteria:
      - context: $response.body
        condition: $.services[0].runningCount > 0
        type: jsonpath
    - name: drained
      type: goto
      stepId: deleteService
      criteria:
      - context: $response.body
        condition: $.services[0].runningCount == 0
        type: jsonpath
  - stepId: deleteService
    description: Delete the now-drained service from the cluster.
    operationId: deleteService
    parameters:
    - name: X-Amz-Target
      in: header
      value: AmazonEC2ContainerServiceV20141113.DeleteService
    requestBody:
      contentType: application/x-amz-json-1.1
      payload:
        cluster: $inputs.cluster
        service: $inputs.service
        force: false
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      serviceArn: $response.body#/service/serviceArn
      finalStatus: $response.body#/service/status
  outputs:
    serviceArn: $steps.deleteService.outputs.serviceArn
    finalStatus: $steps.deleteService.outputs.finalStatus

Work with this as data

Every workflow here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for arazzo workflows

4 MCP tools reach this
  • find_arazzoBrowse and filter every workflow in the catalog.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This workflow
curl "https://apis.io/api/v1/arazzo/amazon-fargate-teardown-service-workflow"
All arazzo workflows
curl "https://apis.io/api/v1/arazzo?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.