Interface AwsCustomResourceProps

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
AwsCustomResourceProps.Jsii$Proxy

@Generated(value="jsii-pacmak/1.98.0 (build 00b106d)", date="2024-05-08T21:35:15.208Z") @Stability(Stable) public interface AwsCustomResourceProps extends software.amazon.jsii.JsiiSerializable
Properties for AwsCustomResource.

Note that at least onCreate, onUpdate or onDelete must be specified.

Example:

 AwsCustomResource getParameter = AwsCustomResource.Builder.create(this, "GetParameter")
         .onUpdate(AwsSdkCall.builder() // will also be called for a CREATE event
                 .service("SSM")
                 .action("GetParameter")
                 .parameters(Map.of(
                         "Name", "my-parameter",
                         "WithDecryption", true))
                 .physicalResourceId(PhysicalResourceId.of(Date.now().toString())).build())
         .policy(AwsCustomResourcePolicy.fromSdkCalls(SdkCallsPolicyOptions.builder()
                 .resources(AwsCustomResourcePolicy.ANY_RESOURCE)
                 .build()))
         .build();
 // Use the value in another construct with
 getParameter.getResponseField("Parameter.Value");
 
  • Method Details

    • getFunctionName

      @Stability(Stable) @Nullable default String getFunctionName()
      A name for the singleton Lambda function implementing this custom resource.

      The function name will remain the same after the first AwsCustomResource is created in a stack.

      Default: - AWS CloudFormation generates a unique physical ID and uses that ID for the function's name. For more information, see Name Type.

    • getInstallLatestAwsSdk

      @Stability(Stable) @Nullable default Boolean getInstallLatestAwsSdk()
      Whether to install the latest AWS SDK v2.

      If not specified, this uses whatever JavaScript SDK version is the default in AWS Lambda at the time of execution.

      Otherwise, installs the latest version from 'npmjs.com'. The installation takes around 60 seconds and requires internet connectivity.

      The default can be controlled using the context key @aws-cdk/customresources:installLatestAwsSdkDefault is.

      Default: - The value of `@aws-cdk/customresources:installLatestAwsSdkDefault`, otherwise `true`

    • getLogGroup

      @Stability(Stable) @Nullable default ILogGroup getLogGroup()
      The Log Group used for logging of events emitted by the custom resource's lambda function.

      Providing a user-controlled log group was rolled out to commercial regions on 2023-11-16. If you are deploying to another type of region, please check regional availability first.

      Default: - a default log group created by AWS Lambda

    • getLogRetention

      @Stability(Stable) @Nullable default RetentionDays getLogRetention()
      The number of days log events of the singleton Lambda function implementing this custom resource are kept in CloudWatch Logs.

      This is a legacy API and we strongly recommend you migrate to logGroup if you can. logGroup allows you to create a fully customizable log group and instruct the Lambda function to send logs to it.

      Default: logs.RetentionDays.INFINITE

    • getMemorySize

      @Stability(Stable) @Nullable default Number getMemorySize()
      The memory size for the singleton Lambda function implementing this custom resource.

      Default: 512 mega in case if installLatestAwsSdk is false.

    • getOnCreate

      @Stability(Stable) @Nullable default AwsSdkCall getOnCreate()
      The AWS SDK call to make when the resource is created.

      Default: - the call when the resource is updated

    • getOnDelete

      @Stability(Stable) @Nullable default AwsSdkCall getOnDelete()
      The AWS SDK call to make when the resource is deleted.

      Default: - no call

    • getOnUpdate

      @Stability(Stable) @Nullable default AwsSdkCall getOnUpdate()
      The AWS SDK call to make when the resource is updated.

      Default: - no call

    • getPolicy

      @Stability(Stable) @Nullable default AwsCustomResourcePolicy getPolicy()
      The policy that will be added to the execution role of the Lambda function implementing this custom resource provider.

      The custom resource also implements iam.IGrantable, making it possible to use the grantXxx() methods.

      As this custom resource uses a singleton Lambda function, it's important to note the that function's role will eventually accumulate the permissions/grants from all resources.

      Note that a policy must be specified if role is not provided, as by default a new role is created which requires policy changes to access resources.

      Default: - no policy added

      See Also:
    • getRemovalPolicy

      @Stability(Stable) @Nullable default RemovalPolicy getRemovalPolicy()
      The policy to apply when this resource is removed from the application.

      Default: cdk.RemovalPolicy.Destroy

    • getResourceType

      @Stability(Stable) @Nullable default String getResourceType()
      Cloudformation Resource type.

      Default: - Custom::AWS

    • getRole

      @Stability(Stable) @Nullable default IRole getRole()
      The execution role for the singleton Lambda function implementing this custom resource provider.

      This role will apply to all AwsCustomResource instances in the stack. The role must be assumable by the lambda.amazonaws.com service principal.

      Default: - a new role is created

    • getTimeout

      @Stability(Stable) @Nullable default Duration getTimeout()
      The timeout for the singleton Lambda function implementing this custom resource.

      Default: Duration.minutes(2)

    • getVpc

      @Stability(Stable) @Nullable default IVpc getVpc()
      The vpc to provision the lambda function in.

      Default: - the function is not provisioned inside a vpc.

    • getVpcSubnets

      @Stability(Stable) @Nullable default SubnetSelection getVpcSubnets()
      Which subnets from the VPC to place the lambda function in.

      Only used if 'vpc' is supplied. Note: internet access for Lambdas requires a NAT gateway, so picking Public subnets is not allowed.

      Default: - the Vpc default strategy if not specified

    • builder

      @Stability(Stable) static AwsCustomResourceProps.Builder builder()
      Returns:
      a AwsCustomResourceProps.Builder of AwsCustomResourceProps