CustomResourceProvider

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

Bases: aws_cdk.core.Construct

An AWS-Lambda backed custom resource provider.

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.

  • 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. Default: - no additional inline policy

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

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

role_arn

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

Return type

str

service_token

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

Example:

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

str

Static Methods

classmethod get_or_create(scope, uniqueid, *, code_directory, runtime, description=None, environment=None, 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.

  • 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. Default: - no additional inline policy

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

Return type

str

Returns

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

classmethod get_or_create_provider(scope, uniqueid, *, code_directory, runtime, description=None, environment=None, memory_size=None, policy_statements=None, timeout=None)

Returns a stack-level singleton 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.

  • 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. Default: - no additional inline policy

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

Return type

CustomResourceProvider

Returns

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

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters

x (Any) –

Return type

bool