createImagePipeline
inline suspend fun ImagebuilderClient.createImagePipeline(crossinline block: CreateImagePipelineRequest.Builder.() -> Unit): CreateImagePipelineResponse
Creates a new image pipeline. Use image pipelines to automate the creation and distribution of images. You must specify exactly one recipe for the pipeline, using either a containerRecipeArn or an imageRecipeArn.
Samples
// The following example creates a pipeline that builds a new image version every Sunday at 9 00 AM
// UTC, if the base image or components have updates.
val resp = imagebuilderClient.createImagePipeline {
name = "my-example-pipeline"
description = "Builds a new version of my image every Sunday"
imageRecipeArn = "arn:aws:imagebuilder:us-west-2:111122223333:image-recipe/my-example-recipe/1.0.0"
infrastructureConfigurationArn = "arn:aws:imagebuilder:us-west-2:111122223333:infrastructure-configuration/my-example-infrastructure"
distributionConfigurationArn = "arn:aws:imagebuilder:us-west-2:111122223333:distribution-configuration/my-example-distribution"
schedule = Schedule {
scheduleExpression = "cron(0 9 ? * SUN *)"
pipelineExecutionStartCondition = PipelineExecutionStartCondition.fromValue("EXPRESSION_MATCH_AND_DEPENDENCY_UPDATES_AVAILABLE")
}
status = PipelineStatus.fromValue("ENABLED")
clientToken = "a1b2c3d4-5678-90ab-cdef-EXAMPLE55555"
}Content copied to clipboard
// The following example creates a pipeline that uses your custom build workflow and enables image
// scanning. The schedule evaluates its cron expression in the America Los_Angeles time zone. The auto disable
// policy disables the pipeline after 3 consecutive failed scheduled builds.
val resp = imagebuilderClient.createImagePipeline {
name = "my-example-pipeline"
description = "Builds a scanned image with my custom build workflow on Sunday mornings when dependency updates are available"
imageRecipeArn = "arn:aws:imagebuilder:us-west-2:111122223333:image-recipe/my-example-recipe/1.1.0"
infrastructureConfigurationArn = "arn:aws:imagebuilder:us-west-2:111122223333:infrastructure-configuration/my-example-infrastructure"
distributionConfigurationArn = "arn:aws:imagebuilder:us-west-2:111122223333:distribution-configuration/my-example-distribution"
workflows = listOf<WorkflowConfiguration>(
WorkflowConfiguration {
workflowArn = "arn:aws:imagebuilder:us-west-2:111122223333:workflow/build/my-example-workflow/1.0.0/1"
}
)
executionRole = "arn:aws:iam::111122223333:role/aws-service-role/imagebuilder.amazonaws.com/AWSServiceRoleForImageBuilder"
imageScanningConfiguration = ImageScanningConfiguration {
imageScanningEnabled = true
}
schedule = Schedule {
scheduleExpression = "cron(0 9 ? * SUN *)"
timezone = "America/Los_Angeles"
pipelineExecutionStartCondition = PipelineExecutionStartCondition.fromValue("EXPRESSION_MATCH_AND_DEPENDENCY_UPDATES_AVAILABLE")
autoDisablePolicy = AutoDisablePolicy {
failureCount = 3
}
}
status = PipelineStatus.fromValue("ENABLED")
clientToken = "a1b2c3d4-5678-90ab-cdef-EXAMPLE30303"
}Content copied to clipboard