CustomResourceProviderBaseProps

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

Bases: CustomResourceProviderOptions

Initialization properties for CustomResourceProviderBase.

Parameters:
  • 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.

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

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk

# policy_statements: Any
# size: cdk.Size

custom_resource_provider_base_props = cdk.CustomResourceProviderBaseProps(
    code_directory="codeDirectory",
    runtime_name="runtimeName",

    # the properties below are optional
    description="description",
    environment={
        "environment_key": "environment"
    },
    memory_size=size,
    policy_statements=[policy_statements],
    timeout=cdk.Duration.minutes(30),
    use_cfn_response_wrapper=False
)

Attributes

code_directory

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.

description

A description of the function.

Default:
  • No description.

environment

Key-value pairs that are passed to Lambda as Environment.

Default:
  • No environment variables.

memory_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

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

Example:

provider = CustomResourceProvider.get_or_create_provider(self, "Custom::MyCustomResourceType",
    code_directory=f"{__dirname}/my-handler",
    runtime=CustomResourceProviderRuntime.NODEJS_18_X,
    policy_statements=[{
        "Effect": "Allow",
        "Action": "s3:PutObject*",
        "Resource": "*"
    }
    ]
)
runtime_name

The AWS Lambda runtime and version name to use for the provider.

timeout

AWS Lambda timeout for the provider.

Default:

Duration.minutes(15)

use_cfn_response_wrapper

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.