Amazon Elastic Load Balancing · Arazzo Workflow

Amazon Elastic Load Balancing Drain and Deregister a Target

Version 1.0.0

Confirm a target exists, deregister it, then poll until it has drained.

1 workflow 1 source API 1 provider
View Spec View on GitHub Amazon Web ServicesHigh AvailabilityLoad BalancingNetworkingScalabilityArazzoWorkflows

Provider

amazon-elastic-load-balancing

Workflows

drain-and-deregister-target
Deregister a target and poll until it finishes draining.
Chains describeTargetHealth, deregisterTargets, and a describeTargetHealth poll loop so a target is gracefully removed and the drain is observed to completion.
3 steps inputs: targetGroupArn, targetId, targetPort outputs: drainState, initialState
1
confirmRegistered
describeTargetHealth
Read the target's current health to confirm it is registered.
2
deregisterTarget
deregisterTargets
Deregister the target so the load balancer begins draining it.
3
pollDrain
describeTargetHealth
Poll the target's health and retry while it is still draining, ending once it is no longer in the draining state.

Source API Descriptions

Arazzo Workflow Specification

amazon-elastic-load-balancing-drain-and-deregister-target-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: Amazon Elastic Load Balancing Drain and Deregister a Target
  summary: Confirm a target exists, deregister it, then poll until it has drained.
  description: >-
    Safely removes a target from a target group. It first reads the target's
    current health to confirm it is registered, then deregisters it, and finally
    polls target health and branches: while the target is still draining it
    loops back and checks again, and once the target is no longer reported it
    ends. Each step spells out its request inline so the flow can be read and
    executed without opening the underlying OpenAPI description. The Elastic
    Load Balancing v2 API uses the AWS query protocol, so every operation is a
    GET whose inputs are carried as query parameters rather than a request body.
  version: 1.0.0
sourceDescriptions:
- name: elbv2Api
  url: ../openapi/amazon-elastic-load-balancing-openapi.yml
  type: openapi
workflows:
- workflowId: drain-and-deregister-target
  summary: Deregister a target and poll until it finishes draining.
  description: >-
    Chains describeTargetHealth, deregisterTargets, and a describeTargetHealth
    poll loop so a target is gracefully removed and the drain is observed to
    completion.
  inputs:
    type: object
    required:
    - targetGroupArn
    - targetId
    properties:
      targetGroupArn:
        type: string
        description: The ARN of the target group to deregister from.
      targetId:
        type: string
        description: The ID of the target to deregister.
      targetPort:
        type: integer
        description: The port the target is listening on.
        default: 80
  steps:
  - stepId: confirmRegistered
    description: Read the target's current health to confirm it is registered.
    operationId: describeTargetHealth
    parameters:
    - name: TargetGroupArn
      in: query
      value: $inputs.targetGroupArn
    - name: Targets.member.1.Id
      in: query
      value: $inputs.targetId
    - name: Targets.member.1.Port
      in: query
      value: $inputs.targetPort
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      initialState: $response.body#/targetHealthDescriptions/0/targetHealth/state
  - stepId: deregisterTarget
    description: Deregister the target so the load balancer begins draining it.
    operationId: deregisterTargets
    parameters:
    - name: TargetGroupArn
      in: query
      value: $inputs.targetGroupArn
    - name: Targets.member.1.Id
      in: query
      value: $inputs.targetId
    - name: Targets.member.1.Port
      in: query
      value: $inputs.targetPort
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      deregistered: $statusCode
  - stepId: pollDrain
    description: >-
      Poll the target's health and retry while it is still draining, ending once
      it is no longer in the draining state.
    operationId: describeTargetHealth
    parameters:
    - name: TargetGroupArn
      in: query
      value: $inputs.targetGroupArn
    - name: Targets.member.1.Id
      in: query
      value: $inputs.targetId
    - name: Targets.member.1.Port
      in: query
      value: $inputs.targetPort
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      drainState: $response.body#/targetHealthDescriptions/0/targetHealth/state
    onSuccess:
    - name: stillDraining
      type: retry
      stepId: pollDrain
      retryAfter: 15
      retryLimit: 20
      criteria:
      - context: $response.body
        condition: $.targetHealthDescriptions[0].targetHealth.state == "draining"
        type: jsonpath
    - name: drainComplete
      type: end
  outputs:
    initialState: $steps.confirmRegistered.outputs.initialState
    drainState: $steps.pollDrain.outputs.drainState