Skip to content

create_function async

create_function(
    function_name: FunctionName,
    role: RoleArn,
    code: FunctionCode,
    *,
    config_overrides: Optional[AsyncLambdaClientConfig] = None,
    runtime: Optional[Runtime] = None,
    handler: Optional[Handler] = None,
    description: Optional[Description] = None,
    timeout: Optional[Timeout] = None,
    memory_size: Optional[MemorySize] = None,
    publish: Optional[Boolean] = None,
    publish_to: Optional[FunctionVersionLatestPublished] = None,
    vpc_config: Optional[VpcConfig] = None,
    package_type: Optional[PackageType] = None,
    dead_letter_config: Optional[DeadLetterConfig] = None,
    environment: Optional[Environment] = None,
    kms_key_arn: Optional[KMSKeyArn] = None,
    tracing_config: Optional[TracingConfig] = None,
    tags: Optional[Tags] = None,
    layers: Optional[LayerList] = None,
    file_system_configs: Optional[FileSystemConfigList] = None,
    code_signing_config_arn: Optional[CodeSigningConfigArn] = None,
    image_config: Optional[ImageConfig] = None,
    architectures: Optional[ArchitecturesList] = None,
    ephemeral_storage: Optional[EphemeralStorage] = None,
    snap_start: Optional[SnapStart] = None,
    logging_config: Optional[LoggingConfig] = None,
    tenancy_config: Optional[TenancyConfig] = None,
    capacity_provider_config: Optional[CapacityProviderConfig] = None,
    durable_config: Optional[DurableConfig] = None,
) -> FunctionConfiguration

Creates a Lambda Event Function. To create a function, you need a deployment package and an execution role. The deployment package is a .zip file archive or container image that contains your function code. The execution role grants the function permission to use Amazon Web Services services, such as Amazon CloudWatch Logs for log streaming and X-Ray for request tracing.

If the deployment package is a container image, then you set the package type to Image. For a container image, the code property must include the URI of a container image in the Amazon ECR registry. You do not need to specify the handler and runtime properties.

If the deployment package is a .zip file archive, then you set the package type to Zip. For a .zip file archive, the code property specifies the location of the .zip file. You must also specify the handler and runtime properties. The code in the deployment package must be compatible with the target instruction set architecture of the function (x86-64 or arm64). If you do not specify the architecture, then the default value is x86-64.

When you create a function, Lambda provisions an instance of the function and its supporting resources. If your function connects to a VPC, this process can take a minute or so. During this time, you can't invoke or modify the function. The State, StateReason, and StateReasonCode fields in the response from GetFunctionConfiguration indicate when the function is ready to invoke. For more information, see Lambda function states.

A function has an unpublished version, and can have published versions and aliases. The unpublished version changes when you update your function's code and configuration. A published version is a snapshot of your function code and configuration that can't be changed. An alias is a named resource that maps to a version, and can be changed to map to a different version. Use the Publish parameter to create version 1 of your function from its initial configuration.

The other parameters let you configure version-specific and function-level settings. You can modify version-specific settings later with UpdateFunctionConfiguration. Function-level settings apply to both the unpublished and published versions of the function, and include tags (TagResource) and per-function concurrency limits (PutFunctionConcurrency).

You can use code signing if your deployment package is a .zip file archive. To enable code signing for this function, specify the ARN of a code-signing configuration. When a user attempts to deploy a code package with UpdateFunctionCode, Lambda checks that the code package has a valid signature from a trusted publisher. The code-signing configuration includes set of signing profiles, which define the trusted publishers for this function.

If another Amazon Web Services account or an Amazon Web Services service invokes your function, use AddPermission to grant permission by creating a resource-based Identity and Access Management (IAM) policy. You can grant permissions at the function level, on a version, or on an alias.

To invoke your function directly, use Invoke. To invoke your function in response to events in other Amazon Web Services services, create an event source mapping (CreateEventSourceMapping), or configure a function trigger in the other service. For more information, see Invoking Lambda functions.

Parameters:

  • function_name (FunctionName) –

    The name or ARN of the Lambda function.

    Name formats

    • Function name – my-function.

    • Function ARN – arn:aws:lambda:us-west-2:123456789012:function:my-function.

    • Partial ARN – 123456789012:function:my-function.

    The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • runtime (Optional[Runtime], default: None ) –

    The identifier of the function's runtime. Runtime is required if the deployment package is a .zip file archive. Specifying a runtime results in an error if you're deploying a function using a container image.

    The following list includes deprecated runtimes. Lambda blocks creating new functions and updating existing functions shortly after each runtime is deprecated. For more information, see Runtime use after deprecation.

    For a list of all currently supported runtimes, see Supported runtimes.

  • role (RoleArn) –

    The Amazon Resource Name (ARN) of the function's execution role.

  • handler (Optional[Handler], default: None ) –

    The name of the method within your code that Lambda calls to run 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 Lambda programming model.

  • code (FunctionCode) –

    The code for the function.

  • description (Optional[Description], default: None ) –

    A description of the function.

  • timeout (Optional[Timeout], default: None ) –

    The amount of time (in seconds) that Lambda allows a function to run before stopping it. The default is 3 seconds, and the maximum allowed value is 900 seconds. For functions using Lambda Managed Instances, asynchronous invocations and event source mapping invocations (except Amazon MQ and Amazon DocumentDB) support a maximum allowed value of 5,400 seconds (90 minutes). For more information, see Lambda execution environment.

  • memory_size (Optional[MemorySize], default: 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.

  • publish (Optional[Boolean], default: None ) –

    Set to true to publish the first version of the function during creation.

  • publish_to (Optional[FunctionVersionLatestPublished], default: None ) –

    Specifies where to publish the function version or configuration.

  • vpc_config (Optional[VpcConfig], default: None ) –

    For network connectivity to Amazon Web Services resources in a VPC, specify a list of security groups and subnets in the VPC. 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.

  • package_type (Optional[PackageType], default: None ) –

    The type of deployment package. Set to Image for container image and set to Zip for .zip file archive.

  • dead_letter_config (Optional[DeadLetterConfig], default: 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.

  • environment (Optional[Environment], default: None ) –

    Environment variables that are accessible from function code during execution.

  • kms_key_arn (Optional[KMSKeyArn], default: None ) –

    The ARN of the Key Management Service (KMS) customer managed key that's used to encrypt the following resources:

    • The function's environment variables.

    • The function's Lambda SnapStart snapshots.

    • When used with SourceKMSKeyArn, the unzipped version of the .zip deployment package that's used for function invocations. For more information, see Specifying a customer managed key for Lambda.

    • The optimized version of the container image that's used for function invocations. Note that this is not the same key that's used to protect your container image in the Amazon Elastic Container Registry (Amazon ECR). For more information, see Function lifecycle.

    If you don't provide a customer managed key, Lambda uses an Amazon Web Services owned key or an Amazon Web Services managed key.

  • tracing_config (Optional[TracingConfig], default: None ) –

    Set Mode to Active to sample and trace a subset of incoming requests with X-Ray.

  • tags (Optional[Tags], default: None ) –

    A list of tags to apply to the function.

  • layers (Optional[LayerList], default: None ) –

    A list of function layers to add to the function's execution environment. Specify each layer by its ARN, including the version.

  • file_system_configs (Optional[FileSystemConfigList], default: None ) –

    Connection settings for an Amazon EFS file system or an Amazon S3 Files file system.

  • code_signing_config_arn (Optional[CodeSigningConfigArn], default: None ) –

    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.

  • image_config (Optional[ImageConfig], default: None ) –

    Container image configuration values that override the values in the container image Dockerfile.

  • architectures (Optional[ArchitecturesList], default: None ) –

    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.

  • ephemeral_storage (Optional[EphemeralStorage], default: 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 10,240 MB. For more information, see Configuring ephemeral storage (console).

  • snap_start (Optional[SnapStart], default: None ) –

    The function's SnapStart setting.

  • logging_config (Optional[LoggingConfig], default: None ) –

    The function's Amazon CloudWatch Logs configuration settings.

  • tenancy_config (Optional[TenancyConfig], default: None ) –

    Configuration for multi-tenant applications that use Lambda functions. Defines tenant isolation settings and resource allocations. Required for functions supporting multiple tenants.

  • capacity_provider_config (Optional[CapacityProviderConfig], default: None ) –

    Configuration for the capacity provider that manages compute resources for Lambda functions.

  • durable_config (Optional[DurableConfig], default: None ) –

    Configuration settings for durable functions. Enables creating functions with durability that can remember their state and continue execution even after interruptions.

Raises:

Examples:

To create a function The following example creates a function with a deployment package in Amazon S3 and enables X-Ray tracing and environment variable encryption.

>>> await client.create_function(code={'S3Bucket': 'my-bucket-1xpuxmplzrlbh', 'S3Key': 'function.zip'}, description='Process image objects from Amazon S3.', durable_config={'ExecutionTimeout': 31622400, 'RetentionPeriodInDays': 30}, environment={'Variables': {'BUCKET': 'my-bucket-1xpuxmplzrlbh', 'PREFIX': 'inbound'}}, function_name='my-function', handler='index.handler', kms_key_arn='arn:aws:kms:us-west-2:123456789012:key/b0844d6c-xmpl-4463-97a4-d49f50839966', memory_size=256, publish=True, role='arn:aws:iam::123456789012:role/lambda-role', runtime='nodejs12.x', tags={'DEPARTMENT': 'Assets'}, timeout=15, tracing_config={'Mode': 'Active'})
Source code in docs_src/capo_lambda/_services/async__lambda.py
async def create_function(
    self,
    function_name: "capo_lambda.types.function_name.FunctionName",
    role: "capo_lambda.types.role_arn.RoleArn",
    code: "capo_lambda.types.function_code.FunctionCode",
    *,
    config_overrides: Optional[AsyncLambdaClientConfig] = None,
    runtime: Optional["capo_lambda.types.runtime.Runtime"] = None,
    handler: Optional["capo_lambda.types.handler.Handler"] = None,
    description: Optional["capo_lambda.types.description.Description"] = None,
    timeout: Optional["capo_lambda.types.timeout.Timeout"] = None,
    memory_size: Optional["capo_lambda.types.memory_size.MemorySize"] = None,
    publish: Optional["capo_lambda.types.boolean.Boolean"] = None,
    publish_to: Optional[
        "capo_lambda.types.function_version_latest_published.FunctionVersionLatestPublished"
    ] = None,
    vpc_config: Optional["capo_lambda.types.vpc_config.VpcConfig"] = None,
    package_type: Optional["capo_lambda.types.package_type.PackageType"] = None,
    dead_letter_config: Optional[
        "capo_lambda.types.dead_letter_config.DeadLetterConfig"
    ] = None,
    environment: Optional["capo_lambda.types.environment.Environment"] = None,
    kms_key_arn: Optional["capo_lambda.types.kms_key_arn.KMSKeyArn"] = None,
    tracing_config: Optional[
        "capo_lambda.types.tracing_config.TracingConfig"
    ] = None,
    tags: Optional["capo_lambda.types.tags.Tags"] = None,
    layers: Optional["capo_lambda.types.layer_list.LayerList"] = None,
    file_system_configs: Optional[
        "capo_lambda.types.file_system_config_list.FileSystemConfigList"
    ] = None,
    code_signing_config_arn: Optional[
        "capo_lambda.types.code_signing_config_arn.CodeSigningConfigArn"
    ] = None,
    image_config: Optional["capo_lambda.types.image_config.ImageConfig"] = None,
    architectures: Optional[
        "capo_lambda.types.architectures_list.ArchitecturesList"
    ] = None,
    ephemeral_storage: Optional[
        "capo_lambda.types.ephemeral_storage.EphemeralStorage"
    ] = None,
    snap_start: Optional["capo_lambda.types.snap_start.SnapStart"] = None,
    logging_config: Optional[
        "capo_lambda.types.logging_config.LoggingConfig"
    ] = None,
    tenancy_config: Optional[
        "capo_lambda.types.tenancy_config.TenancyConfig"
    ] = None,
    capacity_provider_config: Optional[
        "capo_lambda.types.capacity_provider_config.CapacityProviderConfig"
    ] = None,
    durable_config: Optional[
        "capo_lambda.types.durable_config.DurableConfig"
    ] = None,
) -> "capo_lambda.types.function_configuration.FunctionConfiguration":
    """<p>Creates a Lambda Event Function. To create a function, you need a <a href="https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-package.html">deployment package</a> and an <a href="https://docs.aws.amazon.com/lambda/latest/dg/intro-permission-model.html#lambda-intro-execution-role">execution role</a>. The deployment package is a .zip file archive or container image that contains your function code. The execution role grants the function permission to use Amazon Web Services services, such as Amazon CloudWatch Logs for log streaming and X-Ray for request tracing.</p> <p>If the deployment package is a <a href="https://docs.aws.amazon.com/lambda/latest/dg/lambda-images.html">container image</a>, then you set the package type to <code>Image</code>. For a container image, the code property must include the URI of a container image in the Amazon ECR registry. You do not need to specify the handler and runtime properties.</p> <p>If the deployment package is a <a href="https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-package.html#gettingstarted-package-zip">.zip file archive</a>, then you set the package type to <code>Zip</code>. For a .zip file archive, the code property specifies the location of the .zip file. You must also specify the handler and runtime properties. The code in the deployment package must be compatible with the target instruction set architecture of the function (<code>x86-64</code> or <code>arm64</code>). If you do not specify the architecture, then the default value is <code>x86-64</code>.</p> <p>When you create a function, Lambda provisions an instance of the function and its supporting resources. If your function connects to a VPC, this process can take a minute or so. During this time, you can't invoke or modify the function. The <code>State</code>, <code>StateReason</code>, and <code>StateReasonCode</code> fields in the response from <a>GetFunctionConfiguration</a> indicate when the function is ready to invoke. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/functions-states.html">Lambda function states</a>.</p> <p>A function has an unpublished version, and can have published versions and aliases. The unpublished version changes when you update your function's code and configuration. A published version is a snapshot of your function code and configuration that can't be changed. An alias is a named resource that maps to a version, and can be changed to map to a different version. Use the <code>Publish</code> parameter to create version <code>1</code> of your function from its initial configuration.</p> <p>The other parameters let you configure version-specific and function-level settings. You can modify version-specific settings later with <a>UpdateFunctionConfiguration</a>. Function-level settings apply to both the unpublished and published versions of the function, and include tags (<a>TagResource</a>) and per-function concurrency limits (<a>PutFunctionConcurrency</a>).</p> <p>You can use code signing if your deployment package is a .zip file archive. To enable code signing for this function, specify the ARN of a code-signing configuration. When a user attempts to deploy a code package with <a>UpdateFunctionCode</a>, Lambda checks that the code package has a valid signature from a trusted publisher. The code-signing configuration includes set of signing profiles, which define the trusted publishers for this function.</p> <p>If another Amazon Web Services account or an Amazon Web Services service invokes your function, use <a>AddPermission</a> to grant permission by creating a resource-based Identity and Access Management (IAM) policy. You can grant permissions at the function level, on a version, or on an alias.</p> <p>To invoke your function directly, use <a>Invoke</a>. To invoke your function in response to events in other Amazon Web Services services, create an event source mapping (<a>CreateEventSourceMapping</a>), or configure a function trigger in the other service. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/lambda-invocation.html">Invoking Lambda functions</a>.</p>

    Args:
        function_name: <p>The name or ARN of the Lambda function.</p> <p class="title"> <b>Name formats</b> </p> <ul> <li> <p> <b>Function name</b> – <code>my-function</code>.</p> </li> <li> <p> <b>Function ARN</b> – <code>arn:aws:lambda:us-west-2:123456789012:function:my-function</code>.</p> </li> <li> <p> <b>Partial ARN</b> – <code>123456789012:function:my-function</code>.</p> </li> </ul> <p>The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.</p>
        runtime: <p>The identifier of the function's <a href="https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html"> runtime</a>. Runtime is required if the deployment package is a .zip file archive. Specifying a runtime results in an error if you're deploying a function using a container image.</p> <p>The following list includes deprecated runtimes. Lambda blocks creating new functions and updating existing functions shortly after each runtime is deprecated. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html#runtime-deprecation-levels">Runtime use after deprecation</a>.</p> <p>For a list of all currently supported runtimes, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html#runtimes-supported">Supported runtimes</a>.</p>
        role: <p>The Amazon Resource Name (ARN) of the function's execution role.</p>
        handler: <p>The name of the method within your code that Lambda calls to run 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 <a href="https://docs.aws.amazon.com/lambda/latest/dg/foundation-progmodel.html">Lambda programming model</a>.</p>
        code: <p>The code for the function.</p>
        description: <p>A description of the function.</p>
        timeout: <p>The amount of time (in seconds) that Lambda allows a function to run before stopping it. The default is 3 seconds, and the maximum allowed value is 900 seconds. For functions using Lambda Managed Instances, asynchronous invocations and event source mapping invocations (except Amazon MQ and Amazon DocumentDB) support a maximum allowed value of 5,400 seconds (90 minutes). For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/runtimes-context.html">Lambda execution environment</a>.</p>
        memory_size: <p>The amount of <a href="https://docs.aws.amazon.com/lambda/latest/dg/configuration-function-common.html#configuration-memory-console">memory available to the function</a> 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.</p>
        publish: <p>Set to true to publish the first version of the function during creation.</p>
        publish_to: <p>Specifies where to publish the function version or configuration.</p>
        vpc_config: <p>For network connectivity to Amazon Web Services resources in a VPC, specify a list of security groups and subnets in the VPC. When you connect a function to a VPC, it can access resources and the internet only through that VPC. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/configuration-vpc.html">Configuring a Lambda function to access resources in a VPC</a>.</p>
        package_type: <p>The type of deployment package. Set to <code>Image</code> for container image and set to <code>Zip</code> for .zip file archive.</p>
        dead_letter_config: <p>A dead-letter queue configuration that specifies the queue or topic where Lambda sends asynchronous events when they fail processing. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html#invocation-dlq">Dead-letter queues</a>.</p>
        environment: <p>Environment variables that are accessible from function code during execution.</p>
        kms_key_arn: <p>The ARN of the Key Management Service (KMS) customer managed key that's used to encrypt the following resources:</p> <ul> <li> <p>The function's <a href="https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html#configuration-envvars-encryption">environment variables</a>.</p> </li> <li> <p>The function's <a href="https://docs.aws.amazon.com/lambda/latest/dg/snapstart-security.html">Lambda SnapStart</a> snapshots.</p> </li> <li> <p>When used with <code>SourceKMSKeyArn</code>, the unzipped version of the .zip deployment package that's used for function invocations. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/encrypt-zip-package.html#enable-zip-custom-encryption"> Specifying a customer managed key for Lambda</a>.</p> </li> <li> <p>The optimized version of the container image that's used for function invocations. Note that this is not the same key that's used to protect your container image in the Amazon Elastic Container Registry (Amazon ECR). For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/images-create.html#images-lifecycle">Function lifecycle</a>.</p> </li> </ul> <p>If you don't provide a customer managed key, Lambda uses an <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-owned-cmk">Amazon Web Services owned key</a> or an <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk">Amazon Web Services managed key</a>.</p>
        tracing_config: <p>Set <code>Mode</code> to <code>Active</code> to sample and trace a subset of incoming requests with <a href="https://docs.aws.amazon.com/lambda/latest/dg/services-xray.html">X-Ray</a>.</p>
        tags: <p>A list of <a href="https://docs.aws.amazon.com/lambda/latest/dg/tagging.html">tags</a> to apply to the function.</p>
        layers: <p>A list of <a href="https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html">function layers</a> to add to the function's execution environment. Specify each layer by its ARN, including the version.</p>
        file_system_configs: <p>Connection settings for an Amazon EFS file system or an Amazon S3 Files file system.</p>
        code_signing_config_arn: <p>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.</p>
        image_config: <p>Container image <a href="https://docs.aws.amazon.com/lambda/latest/dg/images-create.html#images-parms">configuration values</a> that override the values in the container image Dockerfile.</p>
        architectures: <p>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 <code>x86_64</code>.</p>
        ephemeral_storage: <p>The size of the function's <code>/tmp</code> directory in MB. The default value is 512, but can be any whole number between 512 and 10,240 MB. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/configuration-function-common.html#configuration-ephemeral-storage">Configuring ephemeral storage (console)</a>.</p>
        snap_start: <p>The function's <a href="https://docs.aws.amazon.com/lambda/latest/dg/snapstart.html">SnapStart</a> setting.</p>
        logging_config: <p>The function's Amazon CloudWatch Logs configuration settings.</p>
        tenancy_config: <p>Configuration for multi-tenant applications that use Lambda functions. Defines tenant isolation settings and resource allocations. Required for functions supporting multiple tenants.</p>
        capacity_provider_config: <p>Configuration for the capacity provider that manages compute resources for Lambda functions.</p>
        durable_config: <p>Configuration settings for durable functions. Enables creating functions with durability that can remember their state and continue execution even after interruptions.</p>

    Raises:
        capo_lambda.errors.code_signing_config_not_found_exception.CodeSigningConfigNotFoundException: <p>The specified code signing configuration does not exist.</p>
        capo_lambda.errors.code_storage_exceeded_exception.CodeStorageExceededException: <p>Your Amazon Web Services account has exceeded its maximum total code size. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html">Lambda quotas</a>.</p>
        capo_lambda.errors.code_verification_failed_exception.CodeVerificationFailedException: <p>The code signature failed one or more of the validation checks for signature mismatch or expiry, and the code signing policy is set to ENFORCE. Lambda blocks the deployment.</p>
        capo_lambda.errors.function_versions_per_capacity_provider_limit_exceeded_exception.FunctionVersionsPerCapacityProviderLimitExceededException: <p>The maximum number of function versions that can be associated with a single capacity provider has been exceeded. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html">Lambda quotas</a>.</p>
        capo_lambda.errors.invalid_code_signature_exception.InvalidCodeSignatureException: <p>The code signature failed the integrity check. If the integrity check fails, then Lambda blocks deployment, even if the code signing policy is set to WARN.</p>
        capo_lambda.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>One of the parameters in the request is not valid.</p>
        capo_lambda.errors.resource_conflict_exception.ResourceConflictException: <p>The resource already exists, or another operation is in progress.</p>
        capo_lambda.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource specified in the request does not exist.</p>
        capo_lambda.errors.service_exception.ServiceException: <p>The Lambda service encountered an internal error.</p>
        capo_lambda.errors.too_many_requests_exception.TooManyRequestsException: <p>The request throughput limit was exceeded. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html#api-requests">Lambda quotas</a>.</p>
        capo_lambda.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To create a function
        The following example creates a function with a deployment package in Amazon S3 and enables X-Ray tracing and environment variable encryption.

        >>> await client.create_function(code={'S3Bucket': 'my-bucket-1xpuxmplzrlbh', 'S3Key': 'function.zip'}, description='Process image objects from Amazon S3.', durable_config={'ExecutionTimeout': 31622400, 'RetentionPeriodInDays': 30}, environment={'Variables': {'BUCKET': 'my-bucket-1xpuxmplzrlbh', 'PREFIX': 'inbound'}}, function_name='my-function', handler='index.handler', kms_key_arn='arn:aws:kms:us-west-2:123456789012:key/b0844d6c-xmpl-4463-97a4-d49f50839966', memory_size=256, publish=True, role='arn:aws:iam::123456789012:role/lambda-role', runtime='nodejs12.x', tags={'DEPARTMENT': 'Assets'}, timeout=15, tracing_config={'Mode': 'Active'})
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_lambda.types.create_function_request.CreateFunctionRequest]",
    ) -> AsyncOperationResponse[
        "capo_lambda.types.function_configuration.FunctionConfiguration"
    ]:
        import capo_lambda._operations.aws_gir_api_service.create_function

        (
            output,
            http_response,
        ) = await capo_lambda._operations.aws_gir_api_service.create_function.async_create_function(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_lambda.types.create_function_request.CreateFunctionRequest",
    ) -> dict[str, Any]:
        import capo_lambda.types.create_function_request

        return capo_lambda.types.create_function_request.redact_sensitive(input_)

    def _redact_output(
        output: "capo_lambda.types.function_configuration.FunctionConfiguration",
    ) -> dict[str, Any]:
        import capo_lambda.types.function_configuration

        return capo_lambda.types.function_configuration.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CreateFunction",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_lambda.types.create_function_request.CreateFunctionRequest = {
        "function_name": function_name,
        "role": role,
        "code": code,
    }
    if runtime is not None:
        input_["runtime"] = runtime
    if handler is not None:
        input_["handler"] = handler
    if description is not None:
        input_["description"] = description
    if timeout is not None:
        input_["timeout"] = timeout
    if memory_size is not None:
        input_["memory_size"] = memory_size
    if publish is not None:
        input_["publish"] = publish
    if publish_to is not None:
        input_["publish_to"] = publish_to
    if vpc_config is not None:
        input_["vpc_config"] = vpc_config
    if package_type is not None:
        input_["package_type"] = package_type
    if dead_letter_config is not None:
        input_["dead_letter_config"] = dead_letter_config
    if environment is not None:
        input_["environment"] = environment
    if kms_key_arn is not None:
        input_["kms_key_arn"] = kms_key_arn
    if tracing_config is not None:
        input_["tracing_config"] = tracing_config
    if tags is not None:
        input_["tags"] = tags
    if layers is not None:
        input_["layers"] = layers
    if file_system_configs is not None:
        input_["file_system_configs"] = file_system_configs
    if code_signing_config_arn is not None:
        input_["code_signing_config_arn"] = code_signing_config_arn
    if image_config is not None:
        input_["image_config"] = image_config
    if architectures is not None:
        input_["architectures"] = architectures
    if ephemeral_storage is not None:
        input_["ephemeral_storage"] = ephemeral_storage
    if snap_start is not None:
        input_["snap_start"] = snap_start
    if logging_config is not None:
        input_["logging_config"] = logging_config
    if tenancy_config is not None:
        input_["tenancy_config"] = tenancy_config
    if capacity_provider_config is not None:
        input_["capacity_provider_config"] = capacity_provider_config
    if durable_config is not None:
        input_["durable_config"] = durable_config

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output