# IPolicyEngine

Contains all properties and methods for both created and imported policy engines.

Extends: IPolicyEngine
Extends: IResource, IPolicyEngineRef, IGrantable
Implemented by: PolicyEngine, PolicyEngineBase

- Source: [`aws-bedrockagentcore/lib/policy/policy-engine-base.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-bedrockagentcore/lib/policy/policy-engine-base.ts#L48)
- Type last changed: v2.269.0 · 10 Sep 2026

## Properties

- `description`: string — The description of the policy engine.

- `env`: [ResourceEnvironment](/cdk/api/v2/docs/aws-cdk-lib.interfaces.ResourceEnvironment.html) — 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.

- `grantPrincipal`: [IPrincipal](/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IPrincipal.html) — The principal to grant permissions to.

- `kmsKey`: [IKey](/cdk/api/v2/docs/aws-cdk-lib.aws_kms.IKey.html) — The KMS key used for encryption.

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

- `policyEngineArn`: string — The ARN of the policy engine resource.

- `policyEngineId`: string — The ID of the policy engine.

- `policyEngineName`: string — The name of the policy engine.

- `policyEngineRef`: [PolicyEngineReference](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_bedrockagentcore.PolicyEngineReference.html) — A reference to a PolicyEngine resource.

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

## Methods

- `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`).

- `grant(grantee: IGrantable, ...actions: string[]): Grant` — Grants IAM actions to the IAM Principal.

  **Parameters**

  - `grantee` — - The IAM principal to grant permissions to.
  - `actions` — - The actions to grant.

- `grantEvaluate(grantee: IGrantable): Grant` — Grants permissions to evaluate policies at runtime .

  This is the primary permission needed by Gateway execution roles to evaluate
  authorization decisions during agent requests. Grant this to roles that need
  to call AuthorizeAction or PartiallyAuthorizeActions.

  **Parameters**

  - `grantee` — - The IAM principal to grant evaluation permissions to.

- `grantEvaluateForGateway(grantee: IGrantable, gateway: IGateway): Grant` — Grants the full set of permissions required for a gateway execution role to use this policy engine, correctly scoped to both the policy engine and gateway ARNs.

  Per the AWS docs, `AuthorizeAction` and `PartiallyAuthorizeActions` require
  both the policy engine ARN and the gateway ARN as resources, while
  `GetPolicyEngine` only needs the policy engine ARN.

  This follows the same pattern as Lambda's `grantInvokeVersion(grantee, version)`.

  **Parameters**

  - `grantee` — - The IAM principal (gateway execution role) to grant permissions to.
  - `gateway` — - The gateway that will use this policy engine [disable-awslint:prefer-ref-interface].

- `grantRead(grantee: IGrantable): Grant` — Grants read permissions on the PolicyEngine.

  This grants runtime read access to policy engine configuration. Use this for
  monitoring, observability, or read-only administrative roles.

  **Parameters**

  - `grantee` — - The IAM principal to grant read permissions to.

- `metric(metricName: string, props?: MetricOptions): Metric` — Return the given named metric for this policy engine.

  **Parameters**

  - `metricName` — The name of the metric.
  - `props` — Optional metric configuration.

- `metricAuthorizationLatency(props?: MetricOptions): Metric` — Return a metric measuring the authorization latency for this policy engine.

  This metric represents the time taken to evaluate authorization policies.

  **Parameters**

  - `props` — Optional metric configuration.

- `metricDeniedRequests(props?: MetricOptions): Metric` — Return a metric containing the number of denied authorization requests for this policy engine.

  This metric tracks authorization requests that were explicitly denied by policies.

  **Parameters**

  - `props` — Optional metric configuration.

- `metricErrors(props?: MetricOptions): Metric` — Return a metric containing the number of errors during authorization for this policy engine.

  This metric tracks errors encountered during policy evaluation.

  **Parameters**

  - `props` — Optional metric configuration.

- `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.

  **Parameters**

  - `mixins` — The mixins to apply.

  **Returns:** This construct for chaining
