Skip to content
v2.274.0

CustomResourceProviderBaseProps Struct ​

Initialization properties for CustomResourceProviderBase.

Example ​

ts
// 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 ​

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.

descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string#
A description of the function.

Default: No description.

environmentoptional{ [key: string]: string }environmentoptionaltyping.Mapping[str, str]environmentoptionalMap<String, String>EnvironmentoptionalIDictionary<string, string>Environmentoptional*map[string]*string#
Key-value pairs that are passed to Lambda as Environment.

Default: No environment variables.

memorySizeoptionalSizememory_sizeoptionalSizememorySizeoptionalSizeMemorySizeoptionalSizeMemorySizeoptionalSize= Size.mebibytes(128)#
The amount of memory that your function has access to.

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

policyStatementsoptionalany[]policy_statementsoptionaltyping.List[Any]policyStatementsoptionalList<Object>PolicyStatementsoptionalobject[]PolicyStatementsoptional*[]interface{}#
A set of IAM policy statements to include in the inline policy of the provider's lambda function.

Default: no additional inline policy

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: '*',
    }
  ],
});
runtimeNamestringruntime_namestrruntimeNameStringRuntimeNamestringRuntimeName*stringrequired#
The AWS Lambda runtime and version name to use for the provider.
timeoutoptionalDurationtimeoutoptionalDurationtimeoutoptionalDurationTimeoutoptionalDurationTimeoutoptionalDuration= Duration.minutes(15)#
AWS Lambda timeout for the provider.
useCfnResponseWrapperoptionalbooleanuse_cfn_response_wrapperoptionalbooluseCfnResponseWrapperoptionalBooleanUseCfnResponseWrapperoptionalboolUseCfnResponseWrapperoptional*bool#
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: true if inlineCode: false and false otherwise.