CustomResourceProps

class aws_cdk.aws_cloudformation.CustomResourceProps(*, provider, properties=None, removal_policy=None, resource_type=None)

Bases: object

__init__(*, provider, properties=None, removal_policy=None, resource_type=None)

Properties to provide a Lambda-backed custom resource.

Parameters
  • provider (ICustomResourceProvider) – The provider which implements the custom resource. You can implement a provider by listening to raw AWS CloudFormation events through an SNS topic or an AWS Lambda function or use the CDK’s custom resource provider framework which makes it easier to implement robust providers:: // use the provider framework from aws-cdk/custom-resources: provider: new custom_resources.Provider({ onEventHandler: myOnEventLambda, isCompleteHandler: myIsCompleteLambda, // optional }); Example:: // invoke an AWS Lambda function when a lifecycle event occurs: provider: CustomResourceProvider.fromLambda(myFunction) Example:: // publish lifecycle events to an SNS topic: provider: CustomResourceProvider.fromTopic(myTopic)

  • properties (Optional[Mapping[str, Any]]) – Properties to pass to the Lambda. Default: - No properties.

  • removal_policy (Optional[RemovalPolicy]) – The policy to apply when this resource is removed from the application. Default: cdk.RemovalPolicy.Destroy

  • resource_type (Optional[str]) – For custom resources, you can specify AWS::CloudFormation::CustomResource (the default) as the resource type, or you can specify your own resource type name. For example, you can use “Custom::MyCustomResourceTypeName”. Custom resource type names must begin with “Custom::” and can include alphanumeric characters and the following characters: _@-. You can specify a custom resource type name up to a maximum length of 60 characters. You cannot change the type during an update. Using your own resource type names helps you quickly differentiate the types of custom resources in your stack. For example, if you had two custom resources that conduct two different ping tests, you could name their type as Custom::PingTester to make them easily identifiable as ping testers (instead of using AWS::CloudFormation::CustomResource). Default: - AWS::CloudFormation::CustomResource

deprecated :deprecated: use core.CustomResourceProps

stability :stability: deprecated

Return type

None

Attributes

properties

Properties to pass to the Lambda.

default :default: - No properties.

stability :stability: deprecated

Return type

Optional[Mapping[str, Any]]

provider

The provider which implements the custom resource.

You can implement a provider by listening to raw AWS CloudFormation events through an SNS topic or an AWS Lambda function or use the CDK’s custom resource provider framework which makes it easier to implement robust providers:

# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
provider: new custom_resources.Provider({
   onEventHandler: myOnEventLambda,
   isCompleteHandler: myIsCompleteLambda, // optional
});

Example:

# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
provider: CustomResourceProvider.fromLambda(myFunction)

Example:

# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
provider: CustomResourceProvider.fromTopic(myTopic)

stability :stability: deprecated

Return type

ICustomResourceProvider

removal_policy

The policy to apply when this resource is removed from the application.

default :default: cdk.RemovalPolicy.Destroy

stability :stability: deprecated

Return type

Optional[RemovalPolicy]

resource_type

For custom resources, you can specify AWS::CloudFormation::CustomResource (the default) as the resource type, or you can specify your own resource type name.

For example, you can use “Custom::MyCustomResourceTypeName”.

Custom resource type names must begin with “Custom::” and can include alphanumeric characters and the following characters: _@-. You can specify a custom resource type name up to a maximum length of 60 characters. You cannot change the type during an update.

Using your own resource type names helps you quickly differentiate the types of custom resources in your stack. For example, if you had two custom resources that conduct two different ping tests, you could name their type as Custom::PingTester to make them easily identifiable as ping testers (instead of using AWS::CloudFormation::CustomResource).

default :default: - AWS::CloudFormation::CustomResource

see :see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cfn-customresource.html#aws-cfn-resource-type-name stability :stability: deprecated

Return type

Optional[str]