Skip to content
v2.273.0

CustomResourceProviderProps Struct ​

Initialization properties for CustomResourceProvider.

Example ​

ts
const provider = CustomResourceProvider.getOrCreateProvider(this, 'Custom::MyCustomResourceType', {
  codeDirectory: `${__dirname}/my-handler`,
  runtime: CustomResourceProviderRuntime.NODEJS_22_X,
});
provider.addToRolePolicy({
  Effect: 'Allow',
  Action: 's3:GetObject',
  Resource: '*',
})

Properties ​

codeDirectorystringcode_directorystrcodeDirectoryStringCodeDirectorystringCodeDirectory*stringrequired#
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.

descriptionstringdescriptionstrdescriptionStringDescriptionstringDescription*string= No description.#
A description of the function.
environment{ [key: string]: string }environmenttyping.Mapping[str, str]environmentMap<String, String>EnvironmentIDictionary<string, string>Environment*map[string]*string= No environment variables.#
Key-value pairs that are passed to Lambda as Environment.
memorySizeSizememory_sizeSizememorySizeSizeMemorySizeSizeMemorySizeSize= Size.mebibytes(128)#
The amount of memory that your function has access to.

Increasing the function's memory also increases its CPU allocation.

policyStatementsany[]policy_statementstyping.List[Any]policyStatementsList<Object>PolicyStatementsobject[]PolicyStatements*[]interface{}= 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
ts
const provider = CustomResourceProvider.getOrCreateProvider(this, 'Custom::MyCustomResourceType', {
  codeDirectory: `${__dirname}/my-handler`,
  runtime: CustomResourceProviderRuntime.NODEJS_18_X,
  policyStatements: [
    {
      Effect: 'Allow',
      Action: 's3:PutObject*',
      Resource: '*',
    }
  ],
});
The AWS Lambda runtime and version to use for the provider.
timeoutDurationtimeoutDurationtimeoutDurationTimeoutDurationTimeoutDuration= Duration.minutes(15)#
AWS Lambda timeout for the provider.
useCfnResponseWrapperbooleanuse_cfn_response_wrapperbooluseCfnResponseWrapperBooleanUseCfnResponseWrapperboolUseCfnResponseWrapper*bool= `true` if `inlineCode: false` an…#
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

Default: true if inlineCode: false and false otherwise.

Used as props by ​