class aws_cdk.CustomResourceProviderBase(scope, id, *, code_directory, runtime_name, description=None, environment=None, memory_size=None, policy_statements=None, timeout=None, use_cfn_response_wrapper=None)

Bases: Construct

Base class for creating a custom resource provider.

  • scope (Construct) –

  • id (str) –

  • code_directory (str) – A local file system directory with the provider’s code. The code will be bundled into a zip asset and wired to the provider’s AWS Lambda function.

  • runtime_name (str) – The AWS Lambda runtime and version name to use for the provider.

  • description (Optional[str]) – A description of the function. Default: - No description.

  • environment (Optional[Mapping[str, str]]) – Key-value pairs that are passed to Lambda as Environment. Default: - No environment variables.

  • memory_size (Optional[Size]) – The amount of memory that your function has access to. Increasing the function’s memory also increases its CPU allocation. Default: Size.mebibytes(128)

  • policy_statements (Optional[Sequence[Any]]) – A set of IAM policy statements to include in the inline policy of the provider’s lambda function. Please note: these are direct IAM JSON policy blobs, not iam.PolicyStatement objects like you will see in the rest of the CDK. Default: - no additional inline policy

  • timeout (Optional[Duration]) – AWS Lambda timeout for the provider. Default: Duration.minutes(15)

  • use_cfn_response_wrapper (Optional[bool]) – Whether or not the cloudformation response wrapper (nodejs-entrypoint.ts) is used. If set to true, nodejs-entrypoint.js is bundled in the same asset as the custom resource and set as the entrypoint. If set to false, the custom resource provided is the entrypoint. Default: - true if inlineCode: false and false otherwise.



Add an IAM policy statement to the inline policy of the provider’s lambda function’s role.

Please note: this is a direct IAM JSON policy blob, not a iam.PolicyStatement object like you will see in the rest of the CDK.


statement (Any) –

Return type:



# my_provider: CustomResourceProvider

    "Effect": "Allow",
    "Action": "s3:GetObject",
    "Resource": "*"

Returns a string representation of this construct.

Return type:




The hash of the lambda code backing this provider.

Can be used to trigger updates on code changes, even when the properties of a custom resource remain unchanged.


The tree node.


The ARN of the provider’s AWS Lambda function role.


The ARN of the provider’s AWS Lambda function which should be used as the serviceToken when defining a custom resource.

Static Methods

classmethod is_construct(x)

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.


x (Any) – Any object.

Return type:



true if x is an object created from a class which extends Construct.