arazzo: 1.0.1 info: title: Amazon EC2 Image Builder Distribute Image summary: Create a distribution configuration, build an image that uses it, and poll until distribution completes. description: >- Defines where image outputs are distributed and then produces an image that honors that configuration. The workflow creates a distribution configuration describing the target Regions, triggers an image build that references the recipe, infrastructure configuration, and the new distribution configuration, and then polls the image until it reaches a terminal state so the caller knows whether distribution succeeded. Every 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: imageBuilderApi url: ../openapi/amazon-ec2-image-builder-openapi.yaml type: openapi workflows: - workflowId: distribute-image summary: Create a distribution configuration, build an image with it, and poll to a terminal state. description: >- Creates a distribution configuration, builds an image that references it, and polls GetImage until the image reaches AVAILABLE, FAILED, or CANCELLED. inputs: type: object required: - distributionName - distributions - imageRecipeArn - infrastructureConfigurationArn properties: distributionName: type: string description: The name of the distribution configuration to create. distributions: type: array description: The list of Distribution objects defining target Regions and outputs. items: type: object imageRecipeArn: type: string description: The ARN of the image recipe to build. infrastructureConfigurationArn: type: string description: The ARN of the infrastructure configuration used to build and test the image. clientToken: type: string description: An idempotency token reused across the create requests. default: arazzo-distribute-image-0001 steps: - stepId: createDistributionConfiguration description: >- Create a distribution configuration that defines and configures the outputs of the build. operationId: CreateDistributionConfiguration requestBody: contentType: application/json payload: name: $inputs.distributionName distributions: $inputs.distributions clientToken: $inputs.clientToken successCriteria: - condition: $statusCode == 200 outputs: distributionConfigurationArn: $response.body#/distributionConfigurationArn - stepId: createImage description: >- Build an image that references the recipe, infrastructure configuration, and the newly created distribution configuration. operationId: CreateImage requestBody: contentType: application/json payload: imageRecipeArn: $inputs.imageRecipeArn infrastructureConfigurationArn: $inputs.infrastructureConfigurationArn distributionConfigurationArn: $steps.createDistributionConfiguration.outputs.distributionConfigurationArn clientToken: $inputs.clientToken successCriteria: - condition: $statusCode == 200 outputs: imageBuildVersionArn: $response.body#/imageBuildVersionArn - stepId: getImage description: >- Poll the image build version, looping while the build and distribution are still in progress. operationId: GetImage parameters: - name: imageBuildVersionArn in: query value: $steps.createImage.outputs.imageBuildVersionArn successCriteria: - condition: $statusCode == 200 outputs: status: $response.body#/image/state/status reason: $response.body#/image/state/reason onSuccess: - name: distributionComplete type: end criteria: - context: $response.body condition: $.image.state.status == "AVAILABLE" type: jsonpath - name: distributionFailed type: end criteria: - context: $response.body condition: $.image.state.status == "FAILED" type: jsonpath - name: distributionCancelled type: end criteria: - context: $response.body condition: $.image.state.status == "CANCELLED" type: jsonpath - name: distributionInProgress type: goto stepId: getImage criteria: - context: $response.body condition: $.image.state.status != "AVAILABLE" && $.image.state.status != "FAILED" && $.image.state.status != "CANCELLED" type: jsonpath outputs: distributionConfigurationArn: $steps.createDistributionConfiguration.outputs.distributionConfigurationArn imageBuildVersionArn: $steps.createImage.outputs.imageBuildVersionArn finalStatus: $steps.getImage.outputs.status