Interface ICfnFunctionProps
Properties for defining a CfnFunction
.
Namespace: Amazon.CDK.AWS.Lambda
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface ICfnFunctionProps
Syntax (vb)
Public Interface ICfnFunctionProps
Remarks
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html
ExampleMetadata: fixture=_generated
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Lambda;
var cfnFunctionProps = new CfnFunctionProps {
Code = new CodeProperty {
ImageUri = "imageUri",
S3Bucket = "s3Bucket",
S3Key = "s3Key",
S3ObjectVersion = "s3ObjectVersion",
ZipFile = "zipFile"
},
Role = "role",
// the properties below are optional
Architectures = new [] { "architectures" },
CodeSigningConfigArn = "codeSigningConfigArn",
DeadLetterConfig = new DeadLetterConfigProperty {
TargetArn = "targetArn"
},
Description = "description",
Environment = new EnvironmentProperty {
Variables = new Dictionary<string, string> {
{ "variablesKey", "variables" }
}
},
EphemeralStorage = new EphemeralStorageProperty {
Size = 123
},
FileSystemConfigs = new [] { new FileSystemConfigProperty {
Arn = "arn",
LocalMountPath = "localMountPath"
} },
FunctionName = "functionName",
Handler = "handler",
ImageConfig = new ImageConfigProperty {
Command = new [] { "command" },
EntryPoint = new [] { "entryPoint" },
WorkingDirectory = "workingDirectory"
},
KmsKeyArn = "kmsKeyArn",
Layers = new [] { "layers" },
LoggingConfig = new LoggingConfigProperty {
ApplicationLogLevel = "applicationLogLevel",
LogFormat = "logFormat",
LogGroup = "logGroup",
SystemLogLevel = "systemLogLevel"
},
MemorySize = 123,
PackageType = "packageType",
ReservedConcurrentExecutions = 123,
Runtime = "runtime",
RuntimeManagementConfig = new RuntimeManagementConfigProperty {
UpdateRuntimeOn = "updateRuntimeOn",
// the properties below are optional
RuntimeVersionArn = "runtimeVersionArn"
},
SnapStart = new SnapStartProperty {
ApplyOn = "applyOn"
},
Tags = new [] { new CfnTag {
Key = "key",
Value = "value"
} },
Timeout = 123,
TracingConfig = new TracingConfigProperty {
Mode = "mode"
},
VpcConfig = new VpcConfigProperty {
Ipv6AllowedForDualStack = false,
SecurityGroupIds = new [] { "securityGroupIds" },
SubnetIds = new [] { "subnetIds" }
}
};
Synopsis
Properties
Architectures | The instruction set architecture that the function supports. |
Code | The code for the function. |
CodeSigningConfigArn | To enable code signing for this function, specify the ARN of a code-signing configuration. |
DeadLetterConfig | A dead-letter queue configuration that specifies the queue or topic where Lambda sends asynchronous events when they fail processing. |
Description | A description of the function. |
Environment | Environment variables that are accessible from function code during execution. |
EphemeralStorage | The size of the function's |
FileSystemConfigs | Connection settings for an Amazon EFS file system. |
FunctionName | The name of the Lambda function, up to 64 characters in length. |
Handler | The name of the method within your code that Lambda calls to run your function. |
ImageConfig | Configuration values that override the container image Dockerfile settings. |
KmsKeyArn | The ARN of the AWS Key Management Service ( AWS KMS ) customer managed key that's used to encrypt your function's environment variables . When Lambda SnapStart is activated, Lambda also uses this key is to encrypt your function's snapshot. If you deploy your function using a container image, Lambda also uses this key to encrypt your function when it's deployed. Note that this is not the same key that's used to protect your container image in the Amazon Elastic Container Registry (Amazon ECR). If you don't provide a customer managed key, Lambda uses a default service key. |
Layers | A list of function layers to add to the function's execution environment. Specify each layer by its ARN, including the version. |
LoggingConfig | The function's Amazon CloudWatch Logs configuration settings. |
MemorySize | The amount of memory available to the function at runtime. Increasing the function memory also increases its CPU allocation. The default value is 128 MB. The value can be any multiple of 1 MB. Note that new AWS accounts have reduced concurrency and memory quotas. AWS raises these quotas automatically based on your usage. You can also request a quota increase. |
PackageType | The type of deployment package. |
ReservedConcurrentExecutions | The number of simultaneous executions to reserve for the function. |
Role | The Amazon Resource Name (ARN) of the function's execution role. |
Runtime | The identifier of the function's runtime . Runtime is required if the deployment package is a .zip file archive. |
RuntimeManagementConfig | Sets the runtime management configuration for a function's version. |
SnapStart | The function's AWS Lambda SnapStart setting. |
Tags | A list of tags to apply to the function. |
Timeout | The amount of time (in seconds) that Lambda allows a function to run before stopping it. |
TracingConfig | Set |
VpcConfig | For network connectivity to AWS resources in a VPC, specify a list of security groups and subnets in the VPC. |
Properties
Architectures
The instruction set architecture that the function supports.
virtual string[] Architectures { get; }
Property Value
System.String[]
Remarks
Enter a string array with one of the valid values (arm64 or x86_64). The default value is x86_64
.
Code
The code for the function.
object Code { get; }
Property Value
System.Object
Remarks
CodeSigningConfigArn
To enable code signing for this function, specify the ARN of a code-signing configuration.
virtual string CodeSigningConfigArn { get; }
Property Value
System.String
Remarks
A code-signing configuration includes a set of signing profiles, which define the trusted publishers for this function.
DeadLetterConfig
A dead-letter queue configuration that specifies the queue or topic where Lambda sends asynchronous events when they fail processing.
virtual object DeadLetterConfig { get; }
Property Value
System.Object
Remarks
Description
A description of the function.
virtual string Description { get; }
Property Value
System.String
Remarks
Environment
Environment variables that are accessible from function code during execution.
virtual object Environment { get; }
Property Value
System.Object
Remarks
EphemeralStorage
The size of the function's /tmp
directory in MB.
virtual object EphemeralStorage { get; }
Property Value
System.Object
Remarks
The default value is 512, but it can be any whole number between 512 and 10,240 MB.
FileSystemConfigs
Connection settings for an Amazon EFS file system.
virtual object FileSystemConfigs { get; }
Property Value
System.Object
Remarks
To connect a function to a file system, a mount target must be available in every Availability Zone that your function connects to. If your template contains an AWS::EFS::MountTarget resource, you must also specify a DependsOn
attribute to ensure that the mount target is created or updated before the function.
For more information about using the DependsOn
attribute, see DependsOn Attribute .
FunctionName
The name of the Lambda function, up to 64 characters in length.
virtual string FunctionName { get; }
Property Value
System.String
Remarks
If you don't specify a name, AWS CloudFormation generates one.
If you specify a name, you cannot perform updates that require replacement of this resource. You can perform updates that require no or some interruption. If you must replace the resource, specify a new name.
Handler
The name of the method within your code that Lambda calls to run your function.
virtual string Handler { get; }
Property Value
System.String
Remarks
Handler is required if the deployment package is a .zip file archive. The format includes the file name. It can also include namespaces and other qualifiers, depending on the runtime. For more information, see Lambda programming model .
ImageConfig
Configuration values that override the container image Dockerfile settings.
virtual object ImageConfig { get; }
Property Value
System.Object
Remarks
KmsKeyArn
The ARN of the AWS Key Management Service ( AWS KMS ) customer managed key that's used to encrypt your function's environment variables . When Lambda SnapStart is activated, Lambda also uses this key is to encrypt your function's snapshot. If you deploy your function using a container image, Lambda also uses this key to encrypt your function when it's deployed. Note that this is not the same key that's used to protect your container image in the Amazon Elastic Container Registry (Amazon ECR). If you don't provide a customer managed key, Lambda uses a default service key.
virtual string KmsKeyArn { get; }
Property Value
System.String
Remarks
Layers
A list of function layers to add to the function's execution environment. Specify each layer by its ARN, including the version.
virtual string[] Layers { get; }
Property Value
System.String[]
Remarks
LoggingConfig
The function's Amazon CloudWatch Logs configuration settings.
virtual object LoggingConfig { get; }
Property Value
System.Object
Remarks
MemorySize
The amount of memory available to the function at runtime. Increasing the function memory also increases its CPU allocation. The default value is 128 MB. The value can be any multiple of 1 MB. Note that new AWS accounts have reduced concurrency and memory quotas. AWS raises these quotas automatically based on your usage. You can also request a quota increase.
virtual Nullable<double> MemorySize { get; }
Property Value
System.Nullable<System.Double>
Remarks
PackageType
The type of deployment package.
virtual string PackageType { get; }
Property Value
System.String
Remarks
Set to Image
for container image and set Zip
for .zip file archive.
ReservedConcurrentExecutions
The number of simultaneous executions to reserve for the function.
virtual Nullable<double> ReservedConcurrentExecutions { get; }
Property Value
System.Nullable<System.Double>
Remarks
Role
The Amazon Resource Name (ARN) of the function's execution role.
string Role { get; }
Property Value
System.String
Remarks
Runtime
The identifier of the function's runtime . Runtime is required if the deployment package is a .zip file archive.
virtual string Runtime { get; }
Property Value
System.String
Remarks
The following list includes deprecated runtimes. For more information, see Runtime deprecation policy .
RuntimeManagementConfig
Sets the runtime management configuration for a function's version.
virtual object RuntimeManagementConfig { get; }
Property Value
System.Object
Remarks
SnapStart
The function's AWS Lambda SnapStart setting.
virtual object SnapStart { get; }
Property Value
System.Object
Remarks
Tags
A list of tags to apply to the function.
virtual ICfnTag[] Tags { get; }
Property Value
ICfnTag[]
Remarks
Timeout
The amount of time (in seconds) that Lambda allows a function to run before stopping it.
virtual Nullable<double> Timeout { get; }
Property Value
System.Nullable<System.Double>
Remarks
The default is 3 seconds. The maximum allowed value is 900 seconds. For more information, see Lambda execution environment .
TracingConfig
Set Mode
to Active
to sample and trace a subset of incoming requests with X-Ray .
virtual object TracingConfig { get; }
Property Value
System.Object
Remarks
VpcConfig
For network connectivity to AWS resources in a VPC, specify a list of security groups and subnets in the VPC.
virtual object VpcConfig { get; }
Property Value
System.Object
Remarks
When you connect a function to a VPC, it can access resources and the internet only through that VPC. For more information, see Configuring a Lambda function to access resources in a VPC .