createWorkflow
inline suspend fun ImagebuilderClient.createWorkflow(crossinline block: CreateWorkflowRequest.Builder.() -> Unit): CreateWorkflowResponse
Creates a new workflow or a new version of an existing workflow. If a workflow with the same name and semantic version already exists, and your request changes its configuration, Image Builder creates a new build version. If the configuration is identical to the latest build version, the request fails because that workflow configuration already exists.
Samples
// The following example creates a build workflow from a YAML workflow document provided inline in the
// request.
val resp = imagebuilderClient.createWorkflow {
name = "my-example-workflow"
semanticVersion = "1.0.0"
description = "Workflow to build an AMI"
type = WorkflowType.fromValue("BUILD")
data = "name: my-example-workflow\ndescription: Workflow to build an AMI\nschemaVersion: 1.0\nsteps:\n - name: LaunchBuildInstance\n action: LaunchInstance\n onFailure: Abort\n inputs:\n waitFor: ssmAgent\n - name: ApplyBuildComponents\n action: ExecuteComponents\n onFailure: Abort\n inputs:\n instanceId.$: $.stepOutputs.LaunchBuildInstance.instanceId\n - name: CreateOutputAMI\n action: CreateImage\n onFailure: Abort\n inputs:\n instanceId.$: $.stepOutputs.LaunchBuildInstance.instanceId\n - name: TerminateBuildInstance\n action: TerminateInstance\n onFailure: Continue\n inputs:\n instanceId.$: $.stepOutputs.LaunchBuildInstance.instanceId\n"
clientToken = "a1b2c3d4-5678-90ab-cdef-EXAMPLE54321"
}Content copied to clipboard