Amazon OpenSearch Service · Arazzo Workflow

Amazon OpenSearch Service Ensure Domain Exists

Version 1.0.0

Create a domain only when it is not already present in the account.

1 workflow 1 source API 1 provider
View Spec View on GitHub AnalyticsElasticsearchFull-Text SearchLog AnalyticsOpenSearchSearchArazzoWorkflows

Provider

amazon-opensearch-service

Workflows

ensure-domain-exists
Create the domain only if it does not already exist.
Checks the account domain list, describes the domain when it already exists, otherwise creates it and polls until the endpoint is ready.
4 steps inputs: clusterConfig, domainName, ebsOptions, engineVersion outputs: domainId, endpoint, existingDomainId
1
listDomains
ListDomainNames
List all domain names in the account to determine whether the requested domain already exists.
2
describeExisting
DescribeDomain
Describe the requested domain to capture its current configuration. This step runs when the domain is expected to already exist; if it does not the flow falls through to create it.
3
createDomain
CreateDomain
Create the domain because it was not found in the account, using the supplied engine version, cluster configuration, and EBS options.
4
pollNewDomain
DescribeDomain
Describe the newly created domain until it reports a published endpoint, looping while the endpoint remains empty.

Source API Descriptions

Arazzo Workflow Specification

amazon-opensearch-service-ensure-domain-exists-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: Amazon OpenSearch Service Ensure Domain Exists
  summary: Create a domain only when it is not already present in the account.
  description: >-
    An idempotent provisioning flow. The workflow lists the existing domain
    names in the account and branches: when the requested domain name is already
    present it simply describes the existing domain and finishes, and when the
    name is absent it creates the domain and waits for its endpoint to come
    online. Each step spells out its request inline so the flow can be read and
    executed without opening the underlying OpenAPI description.
  version: 1.0.0
sourceDescriptions:
- name: openSearchServiceApi
  url: ../openapi/amazon-opensearch-service-openapi.yml
  type: openapi
workflows:
- workflowId: ensure-domain-exists
  summary: Create the domain only if it does not already exist.
  description: >-
    Checks the account domain list, describes the domain when it already exists,
    otherwise creates it and polls until the endpoint is ready.
  inputs:
    type: object
    required:
    - domainName
    properties:
      domainName:
        type: string
        description: Name of the OpenSearch domain to ensure exists.
      engineVersion:
        type: string
        description: OpenSearch or Elasticsearch engine version to create with.
      clusterConfig:
        type: object
        description: Container for the cluster configuration.
      ebsOptions:
        type: object
        description: Container for EBS-based storage options.
  steps:
  - stepId: listDomains
    description: >-
      List all domain names in the account to determine whether the requested
      domain already exists.
    operationId: ListDomainNames
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      domainNames: $response.body#/DomainNames
  - stepId: describeExisting
    description: >-
      Describe the requested domain to capture its current configuration. This
      step runs when the domain is expected to already exist; if it does not the
      flow falls through to create it.
    operationId: DescribeDomain
    parameters:
    - name: domainName
      in: path
      value: $inputs.domainName
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      domainId: $response.body#/DomainId
      arn: $response.body#/ARN
      endpoint: $response.body#/Endpoint
    onSuccess:
    - name: alreadyExists
      type: end
      criteria:
      - context: $response.body
        condition: $.Created == true
        type: jsonpath
    onFailure:
    - name: createInstead
      type: goto
      stepId: createDomain
      criteria:
      - condition: $statusCode == 404
  - stepId: createDomain
    description: >-
      Create the domain because it was not found in the account, using the
      supplied engine version, cluster configuration, and EBS options.
    operationId: CreateDomain
    requestBody:
      contentType: application/json
      payload:
        DomainName: $inputs.domainName
        EngineVersion: $inputs.engineVersion
        ClusterConfig: $inputs.clusterConfig
        EBSOptions: $inputs.ebsOptions
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      domainId: $response.body#/DomainId
      arn: $response.body#/ARN
  - stepId: pollNewDomain
    description: >-
      Describe the newly created domain until it reports a published endpoint,
      looping while the endpoint remains empty.
    operationId: DescribeDomain
    parameters:
    - name: domainName
      in: path
      value: $inputs.domainName
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      endpoint: $response.body#/Endpoint
    onSuccess:
    - name: ready
      type: end
      criteria:
      - context: $response.body
        condition: $.Created == true && $.Endpoint != null
        type: jsonpath
    - name: waiting
      type: goto
      stepId: pollNewDomain
      criteria:
      - context: $response.body
        condition: $.Endpoint == null
        type: jsonpath
  outputs:
    domainId: $steps.createDomain.outputs.domainId
    existingDomainId: $steps.describeExisting.outputs.domainId
    endpoint: $steps.pollNewDomain.outputs.endpoint