# CfnResourcePolicyPropsMixin

Use the ``AWS::Lambda::ResourcePolicy`` resource to attach a resource-based policy to a LAM resource.

A resource-based policy applies to a single LAM resource, for example, a function, function version, or function alias. To learn more about using resource-based policies with LAM, see [Working with resource-based policies in](https://docs.aws.amazon.com/lambda/latest/dg/access-control-resource-based.html) in the *Developer Guide*.
 You can use resource-based policies to grant permissions to other AWS services, AWS accounts and organizations, and IAM users and roles to access your LAM resource. You can also deny access to specific entities, and use the full range of IAM global condition keys to further restrict who has access to your LAM resource. For example, you can limit access to calls originating from a specified IP address or VPC.
 A resource-based policy is a JSON document containing a number of statements. Each statement defines the entities you want to grant permission to, the API actions you want to allow or deny, and the LAM resource you want the statement to apply to. A statement can also optionally include an array of logical conditions using the IAM global condition keys.
 To use the ``AWS::Lambda::ResourcePolicy`` resource, make sure that you have the [resource-based policy permissions for Lambda](https://docs.aws.amazon.com/lambda/latest/dg/access-control-resource-based.html#access-control-resource-based-permissions).
 To learn more about creating resource-based policies, see [Policies and permissions in](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html) in the *User Guide*. For more information about example policies for providing permissions to AWS services, other AWS accounts, and IAM users and roles, see [Example resource-based policies for functions](https://docs.aws.amazon.com/lambda/latest/dg/permissions-function-examples.html) in the *Developer Guide*.
  **Avoid mixing permission resource types**
 To grant permissions to access your function, we recommend using the ``AWS::Lambda::ResourcePolicy`` resource to set access permissions. With this resource, you have more flexibility and fine-grained control than ``AWS::Lambda::Permission``. This resource grants an AWS service or another account permission to call a particular API action on a function.
 You can also use the ``AWS::Lambda::Permission`` resource, however using both ``AWS::Lambda::Permission`` and ``AWS::Lambda::ResourcePolicy`` to set permissions on a function can result in errors. Permissions defined in ``AWS::Lambda::Permission`` can be unintentionally overwritten, whether in a single CFN stack or across multiple stacks. Don't use both resource types to set permissions on a function.
 To migrate existing permissions for a function from ``AWS::Lambda::Permission`` to ``AWS::Lambda::ResourcePolicy``, do the following:
  1.  Set a ``Retain``[deletion policy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html) on the ``AWS::Lambda::Permission`` resources you want to migrate. This is necessary so that Lambda does not delete statements with the same statement ID when you delete these resources.
  1.  Use the [GetResourcePolicy](https://docs.aws.amazon.com/lambda/latest/api/API_GetResourcePolicy.html)LAM API to retrieve the resource-based policy currently attached to the function.
  1.  Use this policy to create a new ``AWS::Lambda::ResourcePolicy`` resource.
  1.  Delete all the existing ``AWS::Lambda::Permission`` resources for the function.

Extends: [Mixin](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Mixin.html) › CfnResourcePolicyPropsMixin
Implements: [IMixin](https://docs.aws.amazon.com/cdk/api/v2/docs/constructs.IMixin.html)

- CloudFormation: [`AWS::Lambda::ResourcePolicy`](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-lambda-resourcepolicy.html)
- Source: Generated at build time
- Type last changed: v2.269.0 · 16 Sep 2026

## Initializer

TypeScript:

```ts
new CfnResourcePolicyPropsMixin(props: CfnResourcePolicyMixinProps, options?: CfnPropertyMixinOptions)
```

Python:

```python
CfnResourcePolicyPropsMixin(props: CfnResourcePolicyMixinProps, options: typing.Optional[CfnPropertyMixinOptions] = None)
```

Java:

```java
new CfnResourcePolicyPropsMixin(CfnResourcePolicyMixinProps props, CfnPropertyMixinOptions options)
```

C# / .NET:

```csharp
new CfnResourcePolicyPropsMixin(CfnResourcePolicyMixinProps props, CfnPropertyMixinOptions? options = null)
```

Golang:

```go
NewCfnResourcePolicyPropsMixin(Props CfnResourcePolicyMixinProps, Options CfnPropertyMixinOptions)
```

## Methods

- `applyTo(construct: IConstruct): void` — Apply the mixin properties to the construct.

- `isMixin(x: any): boolean` (static) — Checks if `x` is a Mixin.

  **Parameters**

  - `x` — Any object.

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

- `supports(construct: IConstruct): boolean` — Check if this mixin supports the given construct.
