AWS Fundamentals Logo
AWS Fundamentals
L1 ConstructAWS::CloudFormation::CustomResource

CfnCustomResource

The `AWS::CloudFormation::CustomResource` resource creates a custom resource. Custom resources provide a way for you to write custom provisioning logic into your CloudFormation templates and have CloudFormation run it anytime you create, update (if you changed the custom resource), or delete a stack. For more information, see [Create custom provisioning logic with custom resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-custom-resources.html) in the *CloudFormation User Guide* . > If you use AWS PrivateLink , custom resources in the VPC must have access to CloudFormation -specific Amazon S3 buckets. Custom resources must send responses to a presigned Amazon S3 URL. If they can't send responses to Amazon S3 , CloudFormation won't receive a response and the stack operation fails. For more information, see [Access CloudFormation using an interface endpoint ( AWS PrivateLink )](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/vpc-interface-endpoints.html) in the *CloudFormation User Guide* .

Import

import { CfnCustomResource } from 'aws-cdk-lib/aws-cloudformation';

Or use the module namespace:

import * as cloudformation from 'aws-cdk-lib/aws-cloudformation';
// cloudformation.CfnCustomResource

Properties

Configuration passed to the constructor as CfnCustomResourceProps.

serviceTokenRequired
string

The service token, such as an Amazon topic ARN or Lambda function ARN. The service token must be from the same Region as the stack. Updates aren't supported.

serviceTimeoutOptional
number

The maximum time, in seconds, that can elapse before a custom resource operation times out. The value must be an integer from 1 to 3600. The default value is 3600 seconds (1 hour).

CloudFormation Resource

This L1 construct maps directly to the following CloudFormation resource type.

Learn AWS the Practical Way

Our bi-weekly newsletter teaches hands-on AWS fundamentals. No certification fluff - just practical knowledge.

Subscribe to Newsletter