Interface CfnFunction.CodeProperty
- All Superinterfaces:
software.amazon.jsii.JsiiSerializable
- All Known Implementing Classes:
CfnFunction.CodeProperty.Jsii$Proxy
- Enclosing class:
CfnFunction
When you specify source code inline for a Node.js function, the
index
file that AWS CloudFormation creates uses the extension.js
. This means that Lambda treats the file as a CommonJS module. ES modules aren't supported for inline functions.
Changes to a deployment package in Amazon S3 or a container image in ECR 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") .sourceKmsKeyArn("sourceKmsKeyArn") .zipFile("zipFile") .build();
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final class
A builder forCfnFunction.CodeProperty
static final class
An implementation forCfnFunction.CodeProperty
-
Method Summary
Modifier and TypeMethodDescriptionbuilder()
default String
URI of a container image in the Amazon ECR registry.default String
An Amazon S3 bucket in the same AWS Region as your function.default String
getS3Key()
The Amazon S3 key of the deployment package.default String
For versioned objects, the version of the deployment package object to use.default String
The ARN of the AWS Key Management Service ( AWS KMS ) customer managed key that's used to encrypt your function's .zip deployment package.default String
(Node.js and Python) The source code of your Lambda function.Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getImageUri
URI of a container image in the Amazon ECR registry.- See Also:
-
getS3Bucket
An Amazon S3 bucket in the same AWS Region as your function.The bucket can be in a different AWS account .
- See Also:
-
getS3Key
The Amazon S3 key of the deployment package.- See Also:
-
getS3ObjectVersion
For versioned objects, the version of the deployment package object to use.- See Also:
-
getSourceKmsKeyArn
The ARN of the AWS Key Management Service ( AWS KMS ) customer managed key that's used to encrypt your function's .zip deployment package. If you don't provide a customer managed key, Lambda uses an AWS owned key .- See Also:
-
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 namedindex
and zips it to create a deployment package . This zip file cannot exceed 4MB. For theHandler
property, the first part of the handler identifier must beindex
. For example,index.handler
.When you specify source code inline for a Node.js function, the
index
file that AWS CloudFormation creates uses the extension.js
. This means that Lambda treats the file as a CommonJS module. ES modules aren't supported for inline functions.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.
- See Also:
-
builder
- Returns:
- a
CfnFunction.CodeProperty.Builder
ofCfnFunction.CodeProperty
-