@Generated(value="jsii-pacmak/1.73.0 (build 6faeda3)", date="2023-01-31T18:36:54.541Z") public interface FunctionOptions extends EventInvokeConfigOptions
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.codeguruprofiler.*; import software.amazon.awscdk.services.ec2.*; import software.amazon.awscdk.services.iam.*; import software.amazon.awscdk.services.kms.*; import software.amazon.awscdk.services.lambda.*; import software.amazon.awscdk.services.logs.*; import software.amazon.awscdk.services.sns.*; import software.amazon.awscdk.services.sqs.*; import software.amazon.awscdk.core.*; Architecture architecture; CodeSigningConfig codeSigningConfig; IDestination destination; IEventSource eventSource; FileSystem fileSystem; Key key; LambdaInsightsVersion lambdaInsightsVersion; LayerVersion layerVersion; PolicyStatement policyStatement; ProfilingGroup profilingGroup; Queue queue; Role role; SecurityGroup securityGroup; Size size; Subnet subnet; SubnetFilter subnetFilter; Topic topic; Vpc vpc; FunctionOptions functionOptions = FunctionOptions.builder() .allowAllOutbound(false) .allowPublicSubnet(false) .architecture(architecture) .architectures(List.of(architecture)) .codeSigningConfig(codeSigningConfig) .currentVersionOptions(VersionOptions.builder() .codeSha256("codeSha256") .description("description") .maxEventAge(Duration.minutes(30)) .onFailure(destination) .onSuccess(destination) .provisionedConcurrentExecutions(123) .removalPolicy(RemovalPolicy.DESTROY) .retryAttempts(123) .build()) .deadLetterQueue(queue) .deadLetterQueueEnabled(false) .deadLetterTopic(topic) .description("description") .environment(Map.of( "environmentKey", "environment")) .environmentEncryption(key) .ephemeralStorageSize(size) .events(List.of(eventSource)) .filesystem(fileSystem) .functionName("functionName") .initialPolicy(List.of(policyStatement)) .insightsVersion(lambdaInsightsVersion) .layers(List.of(layerVersion)) .logRetention(RetentionDays.ONE_DAY) .logRetentionRetryOptions(LogRetentionRetryOptions.builder() .base(Duration.minutes(30)) .maxRetries(123) .build()) .logRetentionRole(role) .maxEventAge(Duration.minutes(30)) .memorySize(123) .onFailure(destination) .onSuccess(destination) .profiling(false) .profilingGroup(profilingGroup) .reservedConcurrentExecutions(123) .retryAttempts(123) .role(role) .securityGroup(securityGroup) .securityGroups(List.of(securityGroup)) .timeout(Duration.minutes(30)) .tracing(Tracing.ACTIVE) .vpc(vpc) .vpcSubnets(SubnetSelection.builder() .availabilityZones(List.of("availabilityZones")) .onePerAz(false) .subnetFilters(List.of(subnetFilter)) .subnetGroupName("subnetGroupName") .subnetName("subnetName") .subnets(List.of(subnet)) .subnetType(SubnetType.ISOLATED) .build()) .build();
Modifier and Type | Interface and Description |
---|---|
static class |
FunctionOptions.Builder
A builder for
FunctionOptions |
static class |
FunctionOptions.Jsii$Proxy
An implementation for
FunctionOptions |
Modifier and Type | Method and Description |
---|---|
static FunctionOptions.Builder |
builder() |
default java.lang.Boolean |
getAllowAllOutbound()
Whether to allow the Lambda to send all network traffic.
|
default java.lang.Boolean |
getAllowPublicSubnet()
Lambda Functions in a public subnet can NOT access the internet.
|
default Architecture |
getArchitecture()
The system architectures compatible with this lambda function.
|
default java.util.List<Architecture> |
getArchitectures()
Deprecated.
use `architecture`
|
default ICodeSigningConfig |
getCodeSigningConfig()
Code signing config associated with this function.
|
default VersionOptions |
getCurrentVersionOptions()
Options for the `lambda.Version` resource automatically created by the `fn.currentVersion` method.
|
default IQueue |
getDeadLetterQueue()
The SQS queue to use if DLQ is enabled.
|
default java.lang.Boolean |
getDeadLetterQueueEnabled()
Enabled DLQ.
|
default ITopic |
getDeadLetterTopic()
The SNS topic to use as a DLQ.
|
default java.lang.String |
getDescription()
A description of the function.
|
default java.util.Map<java.lang.String,java.lang.String> |
getEnvironment()
Key-value pairs that Lambda caches and makes available for your Lambda functions.
|
default IKey |
getEnvironmentEncryption()
The AWS KMS key that's used to encrypt your function's environment variables.
|
default Size |
getEphemeralStorageSize()
The size of the function’s /tmp directory in MiB.
|
default java.util.List<IEventSource> |
getEvents()
Event sources for this function.
|
default FileSystem |
getFilesystem()
The filesystem configuration for the lambda function.
|
default java.lang.String |
getFunctionName()
A name for the function.
|
default java.util.List<PolicyStatement> |
getInitialPolicy()
Initial policy statements to add to the created Lambda Role.
|
default LambdaInsightsVersion |
getInsightsVersion()
Specify the version of CloudWatch Lambda insights to use for monitoring.
|
default java.util.List<ILayerVersion> |
getLayers()
A list of layers to add to the function's execution environment.
|
default RetentionDays |
getLogRetention()
The number of days log events are kept in CloudWatch Logs.
|
default LogRetentionRetryOptions |
getLogRetentionRetryOptions()
When log retention is specified, a custom resource attempts to create the CloudWatch log group.
|
default IRole |
getLogRetentionRole()
The IAM role for the Lambda function associated with the custom resource that sets the retention policy.
|
default java.lang.Number |
getMemorySize()
The amount of memory, in MB, that is allocated to your Lambda function.
|
default java.lang.Boolean |
getProfiling()
Enable profiling.
|
default IProfilingGroup |
getProfilingGroup()
Profiling Group.
|
default java.lang.Number |
getReservedConcurrentExecutions()
The maximum of concurrent executions you want to reserve for the function.
|
default IRole |
getRole()
Lambda execution role.
|
default ISecurityGroup |
getSecurityGroup()
Deprecated.
- This property is deprecated, use securityGroups instead
|
default java.util.List<ISecurityGroup> |
getSecurityGroups()
The list of security groups to associate with the Lambda's network interfaces.
|
default Duration |
getTimeout()
The function execution time (in seconds) after which Lambda terminates the function.
|
default Tracing |
getTracing()
Enable AWS X-Ray Tracing for Lambda Function.
|
default IVpc |
getVpc()
VPC network to place Lambda network interfaces.
|
default SubnetSelection |
getVpcSubnets()
Where to place the network interfaces within the VPC.
|
getMaxEventAge, getOnFailure, getOnSuccess, getRetryAttempts
default java.lang.Boolean getAllowAllOutbound()
If set to false, you must individually add traffic rules to allow the Lambda to connect to network targets.
Default: true
default java.lang.Boolean getAllowPublicSubnet()
Use this property to acknowledge this limitation and still place the function in a public subnet.
Default: false
default Architecture getArchitecture()
Default: Architecture.X86_64
@Deprecated default java.util.List<Architecture> getArchitectures()
Default: [Architecture.X86_64]
default ICodeSigningConfig getCodeSigningConfig()
Default: - Not Sign the Code
default VersionOptions getCurrentVersionOptions()
Default: - default options as described in `VersionOptions`
default IQueue getDeadLetterQueue()
If SNS topic is desired, specify deadLetterTopic
property instead.
Default: - SQS queue with 14 day retention period if `deadLetterQueueEnabled` is `true`
default java.lang.Boolean getDeadLetterQueueEnabled()
If deadLetterQueue
is undefined,
an SQS queue with default options will be defined for your Function.
Default: - false unless `deadLetterQueue` is set, which implies DLQ is enabled.
default ITopic getDeadLetterTopic()
Note that if deadLetterQueueEnabled
is set to true
, an SQS queue will be created
rather than an SNS topic. Using an SNS topic as a DLQ requires this property to be set explicitly.
Default: - no SNS topic
default java.lang.String getDescription()
Default: - No description.
default java.util.Map<java.lang.String,java.lang.String> getEnvironment()
Use environment variables to apply configuration changes, such as test and production environment configurations, without changing your Lambda function source code.
Default: - No environment variables.
default IKey getEnvironmentEncryption()
Default: - AWS Lambda creates and uses an AWS managed customer master key (CMK).
default Size getEphemeralStorageSize()
Default: 512 MiB
default java.util.List<IEventSource> getEvents()
You can also add event sources using addEventSource
.
Default: - No event sources.
default FileSystem getFilesystem()
Default: - will not mount any filesystem
default java.lang.String getFunctionName()
Default: - AWS CloudFormation generates a unique physical ID and uses that ID for the function's name. For more information, see Name Type.
default java.util.List<PolicyStatement> getInitialPolicy()
You can call addToRolePolicy
to the created lambda to add statements post creation.
Default: - No policy statements are added to the created Lambda role.
default LambdaInsightsVersion getInsightsVersion()
Default: - No Lambda Insights
default java.util.List<ILayerVersion> getLayers()
You can configure your Lambda function to pull in additional code during initialization in the form of layers. Layers are packages of libraries or other dependencies that can be used by multiple functions.
Default: - No layers.
default RetentionDays getLogRetention()
When updating
this property, unsetting it doesn't remove the log retention policy. To
remove the retention policy, set the value to INFINITE
.
Default: logs.RetentionDays.INFINITE
default LogRetentionRetryOptions getLogRetentionRetryOptions()
These options control the retry policy when interacting with CloudWatch APIs.
Default: - Default AWS SDK retry options.
default IRole getLogRetentionRole()
Default: - A new role is created.
default java.lang.Number getMemorySize()
Lambda uses this value to proportionally allocate the amount of CPU power. For more information, see Resource Model in the AWS Lambda Developer Guide.
Default: 128
default java.lang.Boolean getProfiling()
Default: - No profiling.
default IProfilingGroup getProfilingGroup()
Default: - A new profiling group will be created if `profiling` is set.
default java.lang.Number getReservedConcurrentExecutions()
Default: - No specific limit - account limit.
default IRole getRole()
This is the role that will be assumed by the function upon execution. It controls the permissions that the function will have. The Role must be assumable by the 'lambda.amazonaws.com' service principal.
The default Role automatically has permissions granted for Lambda execution. If you provide a Role, you must add the relevant AWS managed policies yourself.
The relevant managed policies are "service-role/AWSLambdaBasicExecutionRole" and "service-role/AWSLambdaVPCAccessExecutionRole".
Default: - A unique role will be generated for this lambda function. Both supplied and generated roles can always be changed by calling `addToRolePolicy`.
@Deprecated default ISecurityGroup getSecurityGroup()
Only used if 'vpc' is supplied.
Use securityGroups property instead. Function constructor will throw an error if both are specified.
Default: - If the function is placed within a VPC and a security group is not specified, either by this or securityGroups prop, a dedicated security group will be created for this function.
default java.util.List<ISecurityGroup> getSecurityGroups()
Only used if 'vpc' is supplied.
Default: - If the function is placed within a VPC and a security group is not specified, either by this or securityGroup prop, a dedicated security group will be created for this function.
default Duration getTimeout()
Because the execution time affects cost, set this value based on the function's expected execution time.
Default: Duration.seconds(3)
default Tracing getTracing()
Default: Tracing.Disabled
default IVpc getVpc()
Specify this if the Lambda function needs to access resources in a VPC.
Default: - Function is not placed within a VPC.
default SubnetSelection getVpcSubnets()
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
static FunctionOptions.Builder builder()
builder
in interface EventInvokeConfigOptions
FunctionOptions.Builder
of FunctionOptions