ImageBuilder client

This page contains examples with the ImageBuilder client. See the client introduction for a more detailed description how to use a client. You may also want to consider the authentication documentation to understand the many ways you can authenticate with AWS.

The ImageBuilder package could be installed with Composer.

composer require async-aws/image-builder

A new client object may be instantiated by:

use AsyncAws\ImageBuilder\ImageBuilderClient; $imageBuilder = new ImageBuilderClient();

The authentication parameters is read from the environment by default. You can also specify a AWS access id and secret:

use AsyncAws\ImageBuilder\ImageBuilderClient; $imageBuilder = new ImageBuilderClient([ 'accessKeyId' => 'my_access_key', 'accessKeySecret' => 'my_access_secret', 'region' => 'eu-central-1', ]);

For all available options, see the configuration reference.

Usage

Start an image pipeline execution

use AsyncAws\ImageBuilder\ImageBuilderClient; $imageBuilder = new ImageBuilderClient(); $result = $imageBuilder->startImagePipelineExecution([ 'imagePipelineArn' => 'arn:aws:imagebuilder:us-east-1:123456789012:image-pipeline/example', ]); echo $result->getImageBuildVersionArn();

Get an image

use AsyncAws\ImageBuilder\ImageBuilderClient; $imageBuilder = new ImageBuilderClient(); $result = $imageBuilder->getImage([ 'imageBuildVersionArn' => 'arn:aws:imagebuilder:us-east-1:123456789012:image/example/1.0.0/1', ]); $image = $result->getImage(); echo $image->getState()->getStatus() . PHP_EOL; foreach ($image->getOutputResources()->getAmis() as $ami) { echo $ami->getImage() . PHP_EOL; }

The source code to this page is found on GitHub.