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

The rules to apply for excluding resources from the lifecycle policy rule.

- Stability: [Experimental](/cdk/api/stability.html)
- Source: [`lib/lifecycle-policy.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0-alpha.0/packages/@aws-cdk/aws-imagebuilder-alpha/lib/lifecycle-policy.ts#L226)

## Example

```ts
const excludeAmisPolicy = new imagebuilder.LifecyclePolicy(this, 'ExcludeAmisPolicy', {
  resourceType: imagebuilder.LifecyclePolicyResourceType.AMI_IMAGE,
  details: [
    {
      action: { type: imagebuilder.LifecyclePolicyActionType.DELETE },
      filter: { ageFilter: { age: Duration.days(30) } },
      exclusionRules: {
        amiExclusionRules: {
          isPublic: true,  // Exclude public AMIs
          lastLaunched: Duration.days(7),  // Exclude AMIs launched in last 7 days
          regions: ['us-west-2', 'eu-west-1'],  // Exclude AMIs in specific regions
          sharedAccounts: ['123456789012'],  // Exclude AMIs shared with specific accounts
          tags: {
            Protected: 'true',
            Environment: 'production'
          }
        }
      }
    }
  ],
  resourceSelection: {
    tags: { Team: 'infrastructure' }
  }
});
```

## Properties

- `amiExclusionRules`: [LifecyclePolicyAmiExclusionRules](/cdk/api/v2/docs/@aws-cdk_aws-imagebuilder-alpha.LifecyclePolicyAmiExclusionRules.html) — The rules to apply for excluding AMIs from the lifecycle policy rule.

  **Default:** no exclusion rules are applied on the AMI

- `imageExclusionRules`: [LifecyclePolicyImageExclusionRules](/cdk/api/v2/docs/@aws-cdk_aws-imagebuilder-alpha.LifecyclePolicyImageExclusionRules.html) — The rules to apply for excluding EC2 Image Builder images from the lifecycle policy rule.

  **Default:** no exclusion rules are applied on the image
