interface CustomResourceProviderBaseProps
Language | Type name |
---|---|
.NET | Amazon.CDK.CustomResourceProviderBaseProps |
Go | github.com/aws/aws-cdk-go/awscdk/v2#CustomResourceProviderBaseProps |
Java | software.amazon.awscdk.CustomResourceProviderBaseProps |
Python | aws_cdk.CustomResourceProviderBaseProps |
TypeScript (source) | aws-cdk-lib » CustomResourceProviderBaseProps |
Initialization properties for CustomResourceProviderBase
.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
declare const policyStatements: any;
declare const size: cdk.Size;
const customResourceProviderBaseProps: cdk.CustomResourceProviderBaseProps = {
codeDirectory: 'codeDirectory',
runtimeName: 'runtimeName',
// the properties below are optional
description: 'description',
environment: {
environmentKey: 'environment',
},
memorySize: size,
policyStatements: [policyStatements],
timeout: cdk.Duration.minutes(30),
useCfnResponseWrapper: false,
};
Properties
Name | Type | Description |
---|---|---|
code | string | A local file system directory with the provider's code. |
runtime | string | The AWS Lambda runtime and version name to use for the provider. |
description? | string | A description of the function. |
environment? | { [string]: string } | Key-value pairs that are passed to Lambda as Environment. |
memory | Size | The amount of memory that your function has access to. |
policy | any[] | A set of IAM policy statements to include in the inline policy of the provider's lambda function. |
timeout? | Duration | AWS Lambda timeout for the provider. |
use | boolean | 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. |
codeDirectory
Type:
string
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.
runtimeName
Type:
string
The AWS Lambda runtime and version name to use for the provider.
description?
Type:
string
(optional, default: No description.)
A description of the function.
environment?
Type:
{ [string]: string }
(optional, default: No environment variables.)
Key-value pairs that are passed to Lambda as Environment.
memorySize?
Type:
Size
(optional, default: Size.mebibytes(128))
The amount of memory that your function has access to.
Increasing the function's memory also increases its CPU allocation.
policyStatements?
Type:
any[]
(optional, default: no additional inline policy)
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.
Example
const provider = CustomResourceProvider.getOrCreateProvider(this, 'Custom::MyCustomResourceType', {
codeDirectory: `${__dirname}/my-handler`,
runtime: CustomResourceProviderRuntime.NODEJS_18_X,
policyStatements: [
{
Effect: 'Allow',
Action: 's3:PutObject*',
Resource: '*',
}
],
});
timeout?
Type:
Duration
(optional, default: Duration.minutes(15))
AWS Lambda timeout for the provider.
useCfnResponseWrapper?
Type:
boolean
(optional, default: true
if inlineCode: false
and false
otherwise.)
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.