Interface CfnFunction.CodeProperty

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
CfnFunction.CodeProperty.Jsii$Proxy
Enclosing class:
CfnFunction

@Stability(Stable) public static interface CfnFunction.CodeProperty extends software.amazon.jsii.JsiiSerializable
The deployment package for a Lambda function. To deploy a function defined as a container image, you specify the location of a container image in the Amazon ECR registry. For a .zip file deployment package, you can specify the location of an object in Amazon S3. For Node.js and Python functions, you can specify the function code inline in the template.

Changes to a deployment package in Amazon S3 are not detected automatically during stack updates. To update the function code, change the object key or version in the template.

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.services.lambda.*;
 CodeProperty codeProperty = CodeProperty.builder()
         .imageUri("imageUri")
         .s3Bucket("s3Bucket")
         .s3Key("s3Key")
         .s3ObjectVersion("s3ObjectVersion")
         .zipFile("zipFile")
         .build();
 
  • Method Details

    • getImageUri

      @Stability(Stable) @Nullable default String getImageUri()
      URI of a container image in the Amazon ECR registry.
    • getS3Bucket

      @Stability(Stable) @Nullable default String getS3Bucket()
      An Amazon S3 bucket in the same AWS Region as your function.

      The bucket can be in a different AWS account .

    • getS3Key

      @Stability(Stable) @Nullable default String getS3Key()
      The Amazon S3 key of the deployment package.
    • getS3ObjectVersion

      @Stability(Stable) @Nullable default String getS3ObjectVersion()
      For versioned objects, the version of the deployment package object to use.
    • getZipFile

      @Stability(Stable) @Nullable default String getZipFile()
      (Node.js and Python) The source code of your Lambda function. If you include your function source inline with this parameter, AWS CloudFormation places it in a file named index and zips it to create a deployment package . This zip file cannot exceed 4MB. For the Handler property, the first part of the handler identifier must be index . For example, index.handler .

      For JSON, you must escape quotes and special characters such as newline ( \n ) with a backslash.

      If you specify a function that interacts with an AWS CloudFormation custom resource, you don't have to write your own functions to send responses to the custom resource that invoked the function. AWS CloudFormation provides a response module ( cfn-response ) that simplifies sending responses. See Using AWS Lambda with AWS CloudFormation for details.

    • builder

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