Interface FunctionProps
- All Superinterfaces:
EventInvokeConfigOptions
,FunctionOptions
,software.amazon.jsii.JsiiSerializable
- All Known Subinterfaces:
EdgeFunctionProps
,SingletonFunctionProps
,TriggerFunctionProps
- All Known Implementing Classes:
EdgeFunctionProps.Jsii$Proxy
,FunctionProps.Jsii$Proxy
,SingletonFunctionProps.Jsii$Proxy
,TriggerFunctionProps.Jsii$Proxy
import software.amazon.awscdk.services.lambda.*; Function fn = Function.Builder.create(this, "MyFunc") .runtime(Runtime.NODEJS_14_X) .handler("index.handler") .code(Code.fromInline("exports.handler = handler.toString()")) .build(); Rule rule = Rule.Builder.create(this, "rule") .eventPattern(EventPattern.builder() .source(List.of("aws.ec2")) .build()) .build(); Queue queue = new Queue(this, "Queue"); rule.addTarget(LambdaFunction.Builder.create(fn) .deadLetterQueue(queue) // Optional: add a dead letter queue .maxEventAge(Duration.hours(2)) // Optional: set the maxEventAge retry policy .retryAttempts(2) .build());
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic final class
A builder forFunctionProps
static final class
An implementation forFunctionProps
-
Method Summary
Modifier and TypeMethodDescriptionstatic FunctionProps.Builder
builder()
getCode()
The source code of your Lambda function.The name of the method within your code that Lambda calls to execute your function.The runtime environment for the Lambda function that you are uploading.Methods inherited from interface software.amazon.awscdk.services.lambda.EventInvokeConfigOptions
getMaxEventAge, getOnFailure, getOnSuccess, getRetryAttempts
Methods inherited from interface software.amazon.awscdk.services.lambda.FunctionOptions
getAllowAllOutbound, getAllowPublicSubnet, getArchitecture, getArchitectures, getCodeSigningConfig, getCurrentVersionOptions, getDeadLetterQueue, getDeadLetterQueueEnabled, getDeadLetterTopic, getDescription, getEnvironment, getEnvironmentEncryption, getEphemeralStorageSize, getEvents, getFilesystem, getFunctionName, getInitialPolicy, getInsightsVersion, getLayers, getLogRetention, getLogRetentionRetryOptions, getLogRetentionRole, getMemorySize, getProfiling, getProfilingGroup, getReservedConcurrentExecutions, getRole, getSecurityGroup, getSecurityGroups, getTimeout, getTracing, getVpc, getVpcSubnets
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getCode
The source code of your Lambda function.You can point to a file in an Amazon Simple Storage Service (Amazon S3) bucket or specify your source code as inline text.
-
getHandler
The name of the method within your code that Lambda calls to execute your function.The format includes the file name. It can also include namespaces and other qualifiers, depending on the runtime. For more information, see https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-features.html#gettingstarted-features-programmingmodel.
Use
Handler.FROM_IMAGE
when defining a function from a Docker image.NOTE: If you specify your source code as inline text by specifying the ZipFile property within the Code property, specify index.function_name as the handler.
-
getRuntime
The runtime environment for the Lambda function that you are uploading.For valid values, see the Runtime property in the AWS Lambda Developer Guide.
Use
Runtime.FROM_IMAGE
when when defining a function from a Docker image. -
builder
- Returns:
- a
FunctionProps.Builder
ofFunctionProps
-