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

The age-based filtering to apply in a 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#L157)

## Example

```ts
const disabledPolicy = new imagebuilder.LifecyclePolicy(this, 'DisabledPolicy', {
  lifecyclePolicyName: 'my-disabled-policy',
  description: 'A lifecycle policy that is temporarily disabled',
  status: imagebuilder.LifecyclePolicyStatus.DISABLED,
  resourceType: imagebuilder.LifecyclePolicyResourceType.AMI_IMAGE,
  details: [
    {
      action: { type: imagebuilder.LifecyclePolicyActionType.DELETE },
      filter: { ageFilter: { age: Duration.days(30) } }
    }
  ],
  resourceSelection: {
    tags: { Environment: 'testing' }
  },
  tags: {
    Owner: 'DevOps',
    CostCenter: 'Engineering'
  }
});
```

## Properties

- `age`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) (required) — The minimum age of the resource to filter.

  The provided duration will be rounded up to the nearest
  day/week/month/year value.

- `retainAtLeast`: number = 0 — For age-based filters, the number of EC2 Image Builder images to keep on hand once the rule is applied.

  The value
  must be between 1 and 10.
