CustomResourceProviderBase
- 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:
ConstructBase class for creating a 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_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, notiam.PolicyStatementobjects like you will see in the rest of the CDK. Default: - no additional inline policytimeout (
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 totrue,nodejs-entrypoint.jsis bundled in the same asset as the custom resource and set as the entrypoint. If set tofalse, the custom resource provided is the entrypoint. Default: -trueifinlineCode: falseandfalseotherwise.
Methods
- add_to_role_policy(statement)
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.PolicyStatementobject like you will see in the rest of the CDK.- Parameters:
statement (
Any)- Return type:
None
Example:
# my_provider: CustomResourceProvider my_provider.add_to_role_policy({ "Effect": "Allow", "Action": "s3:GetObject", "Resource": "*" })
- to_string()
Returns a string representation of this construct.
- Return type:
str
Attributes
- code_hash
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.
- node
The tree node.
- role_arn
The ARN of the provider’s AWS Lambda function role.
- service_token
The ARN of the provider’s AWS Lambda function which should be used as the
serviceTokenwhen defining a custom resource.
Static Methods
- classmethod is_construct(x)
Checks if
xis a construct.Use this method instead of
instanceofto properly detectConstructinstances, even when the construct library is symlinked.Explanation: in JavaScript, multiple copies of the
constructslibrary on disk are seen as independent, completely different libraries. As a consequence, the classConstructin each copy of theconstructslibrary is seen as a different class, and an instance of one class will not test asinstanceofthe other class.npm installwill not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of theconstructslibrary can be accidentally installed, andinstanceofwill behave unpredictably. It is safest to avoid usinginstanceof, and using this type-testing method instead.- Parameters:
x (
Any) – Any object.- Return type:
bool- Returns:
true if
xis an object created from a class which extendsConstruct.