> **Experimental**
>
> `@aws-cdk/aws-imagebuilder-alpha` is an [**experimental**](/stability) (alpha) package: its API may change in any release, without a major version bump.
# ImagePipeline

Represents an EC2 Image Builder Image Pipeline.

Extends: Construct › Resource › ImagePipeline
Implements: IImagePipeline, IResource, IEnvironmentAware, IConstruct, IDependable

- Stability: [Experimental](/cdk/api/stability.html)
- Source: [`lib/image-pipeline.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0-alpha.0/packages/@aws-cdk/aws-imagebuilder-alpha/lib/image-pipeline.ts#L565)

## Example

```ts
const workflowPipeline = new imagebuilder.ImagePipeline(this, 'WorkflowPipeline', {
  recipe: exampleImageRecipe,
  workflows: [
    { workflow: imagebuilder.AmazonManagedWorkflow.buildImage(this, 'BuildWorkflow') },
    { workflow: imagebuilder.AmazonManagedWorkflow.testImage(this, 'TestWorkflow') }
  ]
});
```

## Initializer

```ts
new ImagePipeline(scope: Construct, id: string, props: ImagePipelineProps)
```

## Construct Props

- `description`: string = None — The description of the image pipeline.

- `distributionConfiguration`: [IDistributionConfiguration](/cdk/api/v2/docs/@aws-cdk_aws-imagebuilder-alpha.IDistributionConfiguration.html) = None — The distribution configuration used for distributing the image.

- `enhancedImageMetadataEnabled`: boolean = true — If enabled, collects additional information about the image being created, including the operating system (OS) version and package list for the AMI.

- `executionRole`: [IRole](/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IRole.html) = Image Builder will use the SLR if possible. Otherwise, an execution role will be generated — The execution role used to perform workflow actions to build this image.

  By default, the Image Builder Service Linked Role (SLR) will be created automatically and used as the execution
  role. However, when providing a custom set of image workflows for the pipeline, an execution role will be
  generated with the minimal permissions needed to execute the workflows.

  **Default:** Image Builder will use the SLR if possible. Otherwise, an execution role will be generated

- `imageLogGroup`: [ILogGroup](/cdk/api/v2/docs/aws-cdk-lib.aws_logs.ILogGroup.html) = a log group will be created — The log group to use for images created from the image pipeline.

  By default, a log group will be created with the
  format `/aws/imagebuilder/<image-name>`.

- `imagePipelineLogGroup`: [ILogGroup](/cdk/api/v2/docs/aws-cdk-lib.aws_logs.ILogGroup.html) = a log group will be created — The log group to use for the image pipeline.

  By default, a log group will be created with the format
  `/aws/imagebuilder/pipeline/<pipeline-name>`

- `imagePipelineName`: string = a name is generated — The name of the image pipeline.

- `imageScanningEcrRepository`: [IRepository](/cdk/api/v2/docs/aws-cdk-lib.aws_ecr.IRepository.html) = if scanning is enabled, a repository will be created by Image Builder if one is not provided — The container repository that Amazon Inspector scans to identify findings for your container images.

  If a
  repository is not provided, Image Builder creates a repository named `image-builder-image-scanning-repository`
  for vulnerability scanning.

  **Default:** if scanning is enabled, a repository will be created by Image Builder if one is not provided

- `imageScanningEcrTags`: string[] = None — The tags for Image Builder to apply to the output container image that Amazon Inspector scans.

- `imageScanningEnabled`: boolean = false — Indicates whether Image Builder keeps a snapshot of the vulnerability scans that Amazon Inspector runs against the build instance when you create a new image.

- `imageTestsEnabled`: boolean = true — Whether to run tests after building an image.

- `infrastructureConfiguration`: [IInfrastructureConfiguration](/cdk/api/v2/docs/@aws-cdk_aws-imagebuilder-alpha.IInfrastructureConfiguration.html) = an infrastructure configuration will be created with the default settings — The infrastructure configuration used for building the image.

  A default infrastructure configuration will be used if one is not provided.

  The default configuration will create an instance profile and role with minimal permissions needed to build the
  image, attached to the EC2 instance.

  **Default:** an infrastructure configuration will be created with the default settings

- `recipe`: [IRecipeBase](/cdk/api/v2/docs/@aws-cdk_aws-imagebuilder-alpha.IRecipeBase.html) (required) — The recipe that defines the base image, components, and customizations used to build the image.

  This can either be
  an image recipe, or a container recipe.

- `schedule`: [ImagePipelineSchedule](/cdk/api/v2/docs/@aws-cdk_aws-imagebuilder-alpha.ImagePipelineSchedule.html) = none, a manual image pipeline will be created — The schedule of the image pipeline.

  This configures how often and when a pipeline automatically creates a new
  image.

  **Default:** none, a manual image pipeline will be created

- `status`: [ImagePipelineStatus](/cdk/api/v2/docs/@aws-cdk_aws-imagebuilder-alpha.ImagePipelineStatus.html) = ImagePipelineStatus.ENABLED — Indicates whether the pipeline is enabled to be triggered by the provided schedule.

- `tags`: { [key: string]: string } = None — The tags to apply to the image pipeline.

- `workflows`: [WorkflowConfiguration](/cdk/api/v2/docs/@aws-cdk_aws-imagebuilder-alpha.WorkflowConfiguration.html)[] = Image Builder will use a default set of workflows for the build to build, test, and distribute the image — The list of workflow configurations used to build the image.

  **Default:** Image Builder will use a default set of workflows for the build to build, test, and distribute the image

## Properties

- `env`: [ResourceEnvironment](/cdk/api/v2/docs/aws-cdk-lib.interfaces.ResourceEnvironment.html) (required) — The environment this resource belongs to.

  For resources that are created and managed in a Stack (those created by
  creating new class instances like `new Role()`, `new Bucket()`, etc.), this
  is always the same as the environment of the stack they belong to.

  For referenced resources (those obtained from referencing methods like
  `Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
  different than the stack they were imported into.

- `executionRole`: [IRole](/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IRole.html) — The execution role used for the image build.

  If there is no execution role, then the build will be executed with
  the AWSServiceRoleForImageBuilder service-linked role.

- `imagePipelineArn`: string (required) — The ARN of the image pipeline.

- `imagePipelineName`: string (required) — The name of the image pipeline.

- `infrastructureConfiguration`: [IInfrastructureConfiguration](/cdk/api/v2/docs/@aws-cdk_aws-imagebuilder-alpha.IInfrastructureConfiguration.html) (required) — The infrastructure configuration used for the image build.

- `node`: [Node](/cdk/api/v2/docs/constructs.Node.html) (required) — The tree node.

- `PROPERTY_INJECTION_ID`: string (required) (static) — Uniquely identifies this class.

- `stack`: [Stack](/cdk/api/v2/docs/aws-cdk-lib.Stack.html) (required) — The stack in which this resource is defined.

## Methods

- `applyCrossStackReferenceStrength(strength: ReferenceStrength): void` — Override the cross-stack reference strength for this resource.

  When set, any cross-stack reference to this resource will use the specified
  mechanism instead of the global default determined by the
  `@aws-cdk/core:defaultCrossStackReferences` context key. This is useful for
  selectively weakening specific references to avoid the "deadly embrace" problem
  without changing the app-wide default.

  **Parameters**

  - `strength` — - The reference strength to use for this resource.

- `applyRemovalPolicy(policy: RemovalPolicy): void` — Apply the given removal policy to this resource.

  The Removal Policy controls what happens to this resource when it stops
  being managed by CloudFormation, either because you've removed it from the
  CDK application or because you've made a change that requires the resource
  to be replaced.

  The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
  account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).

- `fromImagePipelineArn(scope: Construct, id: string, imagePipelineArn: string): IImagePipeline` (static) — Import an existing image pipeline given its ARN.

- `fromImagePipelineName(scope: Construct, id: string, imagePipelineName: string): IImagePipeline` (static) — Import an existing image pipeline given its name.

  The provided name must be normalized by converting all
  alphabetical characters to lowercase, and replacing all spaces and underscores with hyphens.

- `grant(grantee: IGrantable, ...actions: string[]): Grant` — Grant custom actions to the given grantee for the image pipeline [disable-awslint:no-grants].

  **Parameters**

  - `grantee` — The principal.
  - `actions` — The list of actions.

- `grantDefaultExecutionRolePermissions(grantee: IGrantable): Grant[]` — Grants the default permissions for building an image to the provided execution role.

  [disable-awslint:no-grants]

  **Parameters**

  - `grantee` — The execution role used for the image build.

- `grantRead(grantee: IGrantable): Grant` — Grant read permissions to the given grantee for the image pipeline [disable-awslint:no-grants].

  **Parameters**

  - `grantee` — The principal.

- `grantStartExecution(grantee: IGrantable): Grant` — Grant permissions to the given grantee to start an execution of the image pipeline [disable-awslint:no-grants].

  **Parameters**

  - `grantee` — The principal.

- `isConstruct(x: any): boolean` (static) — Checks if `x` is a construct.

  Use this method instead of `instanceof` to properly detect `Construct`
  instances, even when the construct library is symlinked.

  Explanation: in JavaScript, multiple copies of the `constructs` library on
  disk are seen as independent, completely different libraries. As a
  consequence, the class `Construct` in each copy of the `constructs` library
  is seen as a different class, and an instance of one class will not test as
  `instanceof` the other class. `npm install` will not create installations
  like this, but users may manually symlink construct libraries together or
  use a monorepo tool: in those cases, multiple copies of the `constructs`
  library can be accidentally installed, and `instanceof` will behave
  unpredictably. It is safest to avoid using `instanceof`, and using
  this type-testing method instead.

  **Parameters**

  - `x` — Any object.

  **Returns:** true if `x` is an object created from a class which extends `Construct`.

- `isImagePipeline(x: any): boolean` (static) — Return whether the given object is an ImagePipeline.

- `isOwnedResource(construct: IConstruct): boolean` (static) — Returns true if the construct was created by CDK, and false otherwise.

- `isResource(construct: IConstruct): boolean` (static) — Check whether the given construct is a Resource.

- `onCVEDetected(id: string, options?: OnEventOptions): Rule` — Creates an EventBridge rule for Image Builder CVE detected events.

  **Parameters**

  - `id` — Unique identifier for the rule.
  - `options` — Configuration options for the event rule.

- `onEvent(id: string, options?: OnEventOptions): Rule` — Creates an EventBridge rule for Image Builder events.

  **Parameters**

  - `id` — Unique identifier for the rule.
  - `options` — Configuration options for the event rule.

- `onImageBuildCompleted(id: string, options?: OnEventOptions): Rule` — Creates an EventBridge rule for Image Builder image build completion events.

  **Parameters**

  - `id` — Unique identifier for the rule.
  - `options` — Configuration options for the event rule.

- `onImageBuildFailed(id: string, options?: OnEventOptions): Rule` — Creates an EventBridge rule for Image Builder image build failure events.

  **Parameters**

  - `id` — Unique identifier for the rule.
  - `options` — Configuration options for the event rule.

- `onImageBuildStateChange(id: string, options?: OnEventOptions): Rule` — Creates an EventBridge rule for Image Builder image state change events.

  **Parameters**

  - `id` — Unique identifier for the rule.
  - `options` — Configuration options for the event rule.

- `onImageBuildSucceeded(id: string, options?: OnEventOptions): Rule` — Creates an EventBridge rule for Image Builder image success events.

  **Parameters**

  - `id` — Unique identifier for the rule.
  - `options` — Configuration options for the event rule.

- `onImagePipelineAutoDisabled(id: string, options?: OnEventOptions): Rule` — Creates an EventBridge rule for Image Builder image pipeline automatically disabled events.

  **Parameters**

  - `id` — Unique identifier for the rule.
  - `options` — Configuration options for the event rule.

- `onWaitForAction(id: string, options?: OnEventOptions): Rule` — Creates an EventBridge rule for Image Builder wait for action events.

  **Parameters**

  - `id` — Unique identifier for the rule.
  - `options` — Configuration options for the event rule.

- `toString(): string` — Returns a string representation of this construct.

- `with(...mixins: IMixin[]): IConstruct` — Applies one or more mixins to this construct.

  Mixins are applied in order. The list of constructs is captured at the
  start of the call, so constructs added by a mixin will not be visited.
  Use multiple `with()` calls if subsequent mixins should apply to added
  constructs.
