createImage

abstract suspend fun createImage(input: CreateImageRequest): CreateImageResponse

Creates a new image along with all configured output resources defined in the distribution configuration. You must specify exactly one recipe for your image, using either a containerRecipeArn or an imageRecipeArn.

The response returns as soon as Image Builder creates the new image resource. The image build process runs asynchronously. To check its progress, call GetImage and check the image status.

Samples

// The following example creates a new image from the specified image recipe and infrastructure
// configuration.
val resp = imagebuilderClient.createImage {
    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"
    clientToken = "a1b2c3d4-5678-90ab-cdef-EXAMPLEeeeee"
}
// The following example creates an image that uses your custom build and test workflows. It uses the
// Image Builder service linked role as the execution role. Both test workflows are in the same parallel
// group, so they can run at the same time after the build workflow completes.
val resp = imagebuilderClient.createImage {
    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"
    workflows = listOf<WorkflowConfiguration>(
        WorkflowConfiguration {
            workflowArn = "arn:aws:imagebuilder:us-west-2:111122223333:workflow/build/my-example-workflow/1.0.0/1"
        },
        WorkflowConfiguration {
            workflowArn = "arn:aws:imagebuilder:us-west-2:111122223333:workflow/test/my-example-integration-tests/1.0.0/1"
            parallelGroup = "post-build-tests"
        },
        WorkflowConfiguration {
            workflowArn = "arn:aws:imagebuilder:us-west-2:111122223333:workflow/test/my-example-compliance-tests/1.0.0/1"
            parallelGroup = "post-build-tests"
        }            
    )
    executionRole = "arn:aws:iam::111122223333:role/aws-service-role/imagebuilder.amazonaws.com/AWSServiceRoleForImageBuilder"
    clientToken = "a1b2c3d4-5678-90ab-cdef-EXAMPLE01234"
}