CfnFunctionProps¶
-
class
aws_cdk.aws_lambda.
CfnFunctionProps
(*, code, role, architectures=None, code_signing_config_arn=None, dead_letter_config=None, description=None, environment=None, ephemeral_storage=None, file_system_configs=None, function_name=None, handler=None, image_config=None, kms_key_arn=None, layers=None, memory_size=None, package_type=None, reserved_concurrent_executions=None, runtime=None, tags=None, timeout=None, tracing_config=None, vpc_config=None)¶ Bases:
object
Properties for defining a
CfnFunction
.- Parameters
code (
Union
[IResolvable
,CodeProperty
,Dict
[str
,Any
]]) – The code for the function.role (
str
) – The Amazon Resource Name (ARN) of the function’s execution role.architectures (
Optional
[Sequence
[str
]]) – The instruction set architecture that the function supports. Enter a string array with one of the valid values (arm64 or x86_64). The default value isx86_64
.code_signing_config_arn (
Optional
[str
]) – To enable code signing for this function, specify the ARN of a code-signing configuration. A code-signing configuration includes a set of signing profiles, which define the trusted publishers for this function.dead_letter_config (
Union
[IResolvable
,DeadLetterConfigProperty
,Dict
[str
,Any
],None
]) – A dead letter queue configuration that specifies the queue or topic where Lambda sends asynchronous events when they fail processing. For more information, see Dead Letter Queues .description (
Optional
[str
]) – A description of the function.environment (
Union
[IResolvable
,EnvironmentProperty
,Dict
[str
,Any
],None
]) – Environment variables that are accessible from function code during execution.ephemeral_storage (
Union
[IResolvable
,EphemeralStorageProperty
,Dict
[str
,Any
],None
]) – The size of the function’s /tmp directory in MB. The default value is 512, but can be any whole number between 512 and 10240 MB.file_system_configs (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,FileSystemConfigProperty
,Dict
[str
,Any
]]],None
]) – Connection settings for an Amazon EFS file system. 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 aDependsOn
attribute to ensure that the mount target is created or updated before the function. For more information about using theDependsOn
attribute, see DependsOn Attribute .function_name (
Optional
[str
]) – The name of the Lambda function, up to 64 characters in length. 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 (
Optional
[str
]) – The name of the method within your code that Lambda calls to execute your function. 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 Programming Model .image_config (
Union
[IResolvable
,ImageConfigProperty
,Dict
[str
,Any
],None
]) – Configuration values that override the container image Dockerfile settings. See Container settings .kms_key_arn (
Optional
[str
]) – The ARN of the AWS Key Management Service ( AWS KMS ) key that’s used to encrypt your function’s environment variables. If it’s not provided, AWS Lambda uses a default service key.layers (
Optional
[Sequence
[str
]]) – A list of function layers to add to the function’s execution environment. Specify each layer by its ARN, including the version.memory_size (
Union
[int
,float
,None
]) – 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.package_type (
Optional
[str
]) – The type of deployment package. Set toImage
for container image and setZip
for .zip file archive.reserved_concurrent_executions (
Union
[int
,float
,None
]) – The number of simultaneous executions to reserve for the function.runtime (
Optional
[str
]) – The identifier of the function’s runtime . Runtime is required if the deployment package is a .zip file archive.tags (
Optional
[Sequence
[Union
[CfnTag
,Dict
[str
,Any
]]]]) – A list of tags to apply to the function.timeout (
Union
[int
,float
,None
]) – The amount of time (in seconds) that Lambda allows a function to run before stopping it. The default is 3 seconds. The maximum allowed value is 900 seconds. For additional information, see Lambda execution environment .tracing_config (
Union
[IResolvable
,TracingConfigProperty
,Dict
[str
,Any
],None
]) – SetMode
toActive
to sample and trace a subset of incoming requests with X-Ray .vpc_config (
Union
[IResolvable
,VpcConfigProperty
,Dict
[str
,Any
],None
]) – For network connectivity to AWS resources in a VPC , specify a list of security groups and subnets in the VPC.
- Link
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html
- ExampleMetadata
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_lambda as lambda_ cfn_function_props = lambda.CfnFunctionProps( code=lambda.CfnFunction.CodeProperty( image_uri="imageUri", s3_bucket="s3Bucket", s3_key="s3Key", s3_object_version="s3ObjectVersion", zip_file="zipFile" ), role="role", # the properties below are optional architectures=["architectures"], code_signing_config_arn="codeSigningConfigArn", dead_letter_config=lambda.CfnFunction.DeadLetterConfigProperty( target_arn="targetArn" ), description="description", environment=lambda.CfnFunction.EnvironmentProperty( variables={ "variables_key": "variables" } ), ephemeral_storage=lambda.CfnFunction.EphemeralStorageProperty( size=123 ), file_system_configs=[lambda.CfnFunction.FileSystemConfigProperty( arn="arn", local_mount_path="localMountPath" )], function_name="functionName", handler="handler", image_config=lambda.CfnFunction.ImageConfigProperty( command=["command"], entry_point=["entryPoint"], working_directory="workingDirectory" ), kms_key_arn="kmsKeyArn", layers=["layers"], memory_size=123, package_type="packageType", reserved_concurrent_executions=123, runtime="runtime", tags=[CfnTag( key="key", value="value" )], timeout=123, tracing_config=lambda.CfnFunction.TracingConfigProperty( mode="mode" ), vpc_config=lambda.CfnFunction.VpcConfigProperty( security_group_ids=["securityGroupIds"], subnet_ids=["subnetIds"] ) )
Attributes
-
architectures
¶ The instruction set architecture that the function supports.
Enter a string array with one of the valid values (arm64 or x86_64). The default value is
x86_64
.- Link
- Return type
Optional
[List
[str
]]
-
code
¶ The code for the function.
-
code_signing_config_arn
¶ To enable code signing for this function, specify the ARN of a code-signing configuration.
A code-signing configuration includes a set of signing profiles, which define the trusted publishers for this function.
-
dead_letter_config
¶ A dead letter queue configuration that specifies the queue or topic where Lambda sends asynchronous events when they fail processing.
For more information, see Dead Letter Queues .
-
description
¶ A description of the function.
-
environment
¶ Environment variables that are accessible from function code during execution.
-
ephemeral_storage
¶ The size of the function’s /tmp directory in MB.
The default value is 512, but can be any whole number between 512 and 10240 MB.
-
file_system_configs
¶ Connection settings for an Amazon EFS file system.
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 .- Link
- Return type
Union
[IResolvable
,List
[Union
[IResolvable
,FileSystemConfigProperty
]],None
]
-
function_name
¶ The name of the Lambda function, up to 64 characters in length.
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 execute your function.
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 Programming Model .
- Link
- Return type
Optional
[str
]
-
image_config
¶ Configuration values that override the container image Dockerfile settings.
See Container settings .
-
kms_key_arn
¶ The ARN of the AWS Key Management Service ( AWS KMS ) key that’s used to encrypt your function’s environment variables.
If it’s not provided, AWS Lambda uses a default service key.
-
layers
¶ //docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html>`_ to add to the function’s execution environment. Specify each layer by its ARN, including the version.
- Link
- Type
A list of `function layers <https
- Return type
Optional
[List
[str
]]
-
memory_size
¶ //docs.aws.amazon.com/lambda/latest/dg/configuration-memory.html>`_ 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.
- Link
- Type
The amount of `memory available to the function <https
- Return type
Union
[int
,float
,None
]
-
package_type
¶ The type of deployment package.
Set to
Image
for container image and setZip
for .zip file archive.
-
reserved_concurrent_executions
¶ The number of simultaneous executions to reserve for the function.
- Link
- Return type
Union
[int
,float
,None
]
-
role
¶ The Amazon Resource Name (ARN) of the function’s execution role.
-
runtime
¶ //docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html>`_ . Runtime is required if the deployment package is a .zip file archive.
- Link
- Type
The identifier of the function’s `runtime <https
- Return type
Optional
[str
]
//docs.aws.amazon.com/lambda/latest/dg/tagging.html>`_ to apply to the function.
-
timeout
¶ The amount of time (in seconds) that Lambda allows a function to run before stopping it.
The default is 3 seconds. The maximum allowed value is 900 seconds. For additional information, see Lambda execution environment .
- Link
- Return type
Union
[int
,float
,None
]
-
tracing_config
¶ //docs.aws.amazon.com/lambda/latest/dg/services-xray.html>`_ .
- Link
- Type
Set
Mode
toActive
to sample and trace a subset of incoming requests with `X-Ray <https- Return type
Union
[IResolvable
,TracingConfigProperty
,None
]
-
vpc_config
¶ //docs.aws.amazon.com/lambda/latest/dg/configuration-network.html>`_ , specify a list of security groups and subnets in the VPC.
- Link
- Type
For network connectivity to AWS resources in a `VPC <https
- Return type
Union
[IResolvable
,VpcConfigProperty
,None
]