CustomResourceProvider

class aws_cdk.core.CustomResourceProvider(scope, id, *, code_directory, runtime, memory_size=None, policy_statements=None, timeout=None)

Bases: aws_cdk.core.Construct

An AWS-Lambda backed custom resource provider.

stability :stability: experimental

__init__(scope, id, *, code_directory, runtime, memory_size=None, policy_statements=None, timeout=None)
Parameters
  • 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 (CustomResourceProviderRuntime) – The AWS Lambda runtime and version to use for the provider.

  • 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[List[Any]]) – A set of IAM policy statements to include in the inline policy of the provider’s lambda function. Default: - no additional inline policy

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

stability :stability: experimental

Return type

None

Methods

to_string()

Returns a string representation of this construct.

Return type

str

Attributes

node

The construct tree node associated with this construct.

Return type

ConstructNode

service_token

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

stability :stability: experimental

Example:

# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
CustomResource(self, "MyCustomResource",
    # ...
    service_token=provider.service_token
)
Return type

str

Static Methods

classmethod get_or_create(scope, uniqueid, *, code_directory, runtime, memory_size=None, policy_statements=None, timeout=None)

Returns a stack-level singleton ARN (service token) for the custom resource provider.

Parameters
  • scope (Construct) – Construct scope.

  • uniqueid (str) – A globally unique id that will be used for the stack-level construct.

  • 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 (CustomResourceProviderRuntime) – The AWS Lambda runtime and version to use for the provider.

  • 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[List[Any]]) – A set of IAM policy statements to include in the inline policy of the provider’s lambda function. Default: - no additional inline policy

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

return :rtype: str :return:

the service token of the custom resource provider, which should be used when defining a CustomResource.

stability :stability: experimental

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters

x (Any) –

Return type

bool