Table of Contents

Interface ICustomResourceProviderProps

Namespace
Amazon.CDK
Assembly
Amazon.CDK.dll

Initialization properties for CustomResourceProvider.

public interface ICustomResourceProviderProps

Examples

var serviceToken = CustomResourceProvider.GetOrCreate(this, "Custom::MyCustomResourceType", new CustomResourceProviderProps {
                CodeDirectory = $"{__dirname}/my-handler",
                Runtime = CustomResourceProviderRuntime.NODEJS_14_X,
                Description = "Lambda function created by the custom resource provider"
            });

            new CustomResource(this, "MyResource", new CustomResourceProps {
                ResourceType = "Custom::MyCustomResourceType",
                ServiceToken = serviceToken
            });

Remarks

ExampleMetadata: infused

Properties

CodeDirectory

A local file system directory with the provider's code.

string CodeDirectory { get; }

Property Value

string

Remarks

The code will be bundled into a zip asset and wired to the provider's AWS Lambda function.

Description

A description of the function.

string? Description { get; }

Property Value

string

Remarks

Default: - No description.

Environment

Key-value pairs that are passed to Lambda as Environment.

IDictionary<string, string>? Environment { get; }

Property Value

IDictionary<string, string>

Remarks

Default: - No environment variables.

MemorySize

The amount of memory that your function has access to.

Size? MemorySize { get; }

Property Value

Size

Remarks

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

Default: Size.mebibytes(128)

PolicyStatements

A set of IAM policy statements to include in the inline policy of the provider's lambda function.

object[]? PolicyStatements { get; }

Property Value

object[]

Examples

var provider = CustomResourceProvider.GetOrCreateProvider(this, "Custom::MyCustomResourceType", new CustomResourceProviderProps {
                 CodeDirectory = $"{__dirname}/my-handler",
                 Runtime = CustomResourceProviderRuntime.NODEJS_14_X,
                 PolicyStatements = new [] { new Dictionary<string, string> {
                     { "Effect", "Allow" },
                     { "Action", "s3:PutObject*" },
                     { "Resource", "*" }
                 } }
             });

Remarks

Please note: these are direct IAM JSON policy blobs, not iam.PolicyStatement objects like you will see in the rest of the CDK.

Default: - no additional inline policy

Runtime

The AWS Lambda runtime and version to use for the provider.

CustomResourceProviderRuntime Runtime { get; }

Property Value

CustomResourceProviderRuntime

Timeout

AWS Lambda timeout for the provider.

Duration? Timeout { get; }

Property Value

Duration

Remarks

Default: Duration.minutes(15)