LambdaWeb / Client / create_web_function

create_web_function

LambdaWeb.Client.create_web_function(**kwargs)

Creates a web function with an initial revision and endpoint. To create a web function, you provide the function name, revision configuration (code and service settings), and endpoint configuration.

To use this operation, you must have the CreateWebFunction permission on the web function. You don’t need separate permissions for the initial revision or endpoint.

See also: AWS API Documentation

Request Syntax

response = client.create_web_function(
    functionName='string',
    revisionConfig={
        'description': 'string',
        'kmsKeyArn': 'string',
        'buildConfig': {
            'codeConfig': {
                's3Object': {
                    'bucket': 'string',
                    'key': 'string',
                    'versionId': 'string'
                }
            },
            'runtimeConfig': {
                'runtime': 'string'
            }
        },
        'serviceConfig': {
            'executionRoleArn': 'string',
            'timeoutSeconds': 123,
            'egressNetworkConnectorArn': 'string',
            'maxConcurrencyPerEnvironment': 123,
            'environmentVariables': {
                'string': 'string'
            },
            'telemetryConfig': {
                'loggingConfig': {
                    'logGroup': 'string',
                    'applicationLogLevel': 'TRACE'|'DEBUG'|'INFO'|'WARN'|'ERROR'|'FATAL',
                    'systemLogLevel': 'DEBUG'|'INFO'|'WARN'
                }
            }
        }
    },
    endpointConfig={
        'endpointName': 'string',
        'description': 'string',
        'endpointType': 'HomeRegion'|'MultiRegion'|'PerRegion',
        'authType': 'ApplicationManaged'|'IamAuth',
        'autoDeploymentMode': 'LatestRevision'|'Disabled',
        'regions': [
            'string',
        ],
        'scalingConfig': {
            'maxEnvironments': 123
        },
        'throttleConfig': {
            'rateLimit': 123
        }
    },
    tags={
        'string': 'string'
    }
)
Parameters:
  • functionName (string) –

    [REQUIRED]

    The name of the web function. The name can contain letters, numbers, hyphens (-), and underscores (_), and can’t begin or end with a hyphen or an underscore. The name is limited to 64 characters in length.

  • revisionConfig (dict) –

    The configuration for the initial revision of the web function, including code and service settings.

    • description (string) –

      A description of the revision.

    • kmsKeyArn (string) –

      The Amazon Resource Name (ARN) of the AWS Key Management Service (AWS KMS) key used to encrypt the revision’s code and environment variables.

    • buildConfig (dict) – [REQUIRED]

      The build configuration for the revision.

      • codeConfig (dict) – [REQUIRED]

        The code configuration specifying where the deployment artifact is stored.

        • s3Object (dict) – [REQUIRED]

          The Amazon S3 location of the deployment artifact.

          • bucket (string) – [REQUIRED]

            The name of the Amazon S3 bucket.

          • key (string) – [REQUIRED]

            The Amazon S3 object key.

          • versionId (string) –

            The version ID of the Amazon S3 object.

      • runtimeConfig (dict) – [REQUIRED]

        The runtime configuration for the revision.

        • runtime (string) – [REQUIRED]

          The runtime identifier for the web function (for example, a Node.js runtime identifier).

    • serviceConfig (dict) – [REQUIRED]

      The service configuration for the revision.

      • executionRoleArn (string) – [REQUIRED]

        The ARN of the IAM role that the web function assumes when it runs. This role provides permissions to access AWS services and resources.

      • timeoutSeconds (integer) –

        The amount of time (in seconds) that Lambda allows the web function to run before stopping it. Minimum value of 3, maximum value of 900. If you don’t specify a value, the default is 30, and this default is returned in the response.

      • egressNetworkConnectorArn (string) –

        The Amazon Resource Name (ARN) of the Lambda network connector that gives the web function access to resources in your VPC. You must specify the fully qualified ARN, including the connector version, which pins the revision to that version. If the network connector is deleted, invocations of revisions that reference it fail. Revisions that specify a network connector support only HomeRegion endpoints, not MultiRegion or PerRegion.

      • maxConcurrencyPerEnvironment (integer) –

        The maximum number of concurrent requests handled per execution environment. Minimum value of 1, maximum value of 128. If you don’t specify a value, the default is 64, and this default is returned in the response.

      • environmentVariables (dict) –

        A map of environment variable key-value pairs available to the web function at runtime. Environment variable values are sensitive.

        • (string) –

          • (string) –

      • telemetryConfig (dict) –

        The telemetry configuration for the web function, including logging settings.

        • loggingConfig (dict) –

          The logging configuration for the web function.

          • logGroup (string) –

            The name of the Amazon CloudWatch Logs log group the web function sends logs to. If you don’t specify a value, the default is /aws/lambda/web/{functionName}, and this default is returned in the response.

          • applicationLogLevel (string) –

            The log level for application logs emitted by the web function. If you don’t specify a value, the default is INFO, and this default is returned in the response.

          • systemLogLevel (string) –

            The log level for system logs emitted by the Lambda runtime. If you don’t specify a value, the default is INFO, and this default is returned in the response.

  • endpointConfig (dict) –

    The configuration for the initial endpoint of the web function.

    • endpointName (string) – [REQUIRED]

      The name of the endpoint. The name can contain letters, numbers, hyphens (-), and underscores (_), and can’t begin or end with a hyphen or an underscore. The name is limited to 64 characters in length.

    • description (string) –

      A description of the endpoint.

    • endpointType (string) – [REQUIRED]

      The type of endpoint. Determines how traffic is served and routed across Regions.

      Valid values:

      • HomeRegion – Serves traffic from the Region where you created the web function.

      • MultiRegion – Replicates across the Regions that you choose and routes each request to the nearest one.

      • PerRegion – Creates a separate endpoint in each Region that you choose.

    • authType (string) – [REQUIRED]

      The authorization type for the endpoint.

      Valid values:

      • ApplicationManaged – Your application handles authorization.

      • IamAuth – Lambda uses IAM to authorize requests, which must be signed with Signature Version 4 (SigV4).

    • autoDeploymentMode (string) –

      The auto-deployment mode for the endpoint. If you don’t specify a value, the default is Disabled, and this default is returned in the response.

      Valid values:

      • LatestRevision – The endpoint automatically serves the newest revision.

      • Disabled – Revision routing stays fixed until you change it.

    • regions (list) –

      The list of Regions for the endpoint. Required when the endpoint type is MultiRegion or PerRegion: specify at least one Region other than the Region where you create the endpoint (the home Region). The home Region is added automatically if you don’t include it; specifying only the home Region isn’t allowed. When the endpoint type is HomeRegion, omit this field or specify only the home Region.

      • (string) –

    • scalingConfig (dict) –

      The scaling configuration for the endpoint.

      • maxEnvironments (integer) –

        The maximum number of concurrent execution environments for the endpoint. Minimum value of 2, maximum value of 10000. There is no default value. If you don’t specify a value, the scaling configuration is absent from the response. On an update, omit scalingConfig to keep the current value, or specify an empty object to clear a previously set value.

    • throttleConfig (dict) –

      The throttling configuration for the endpoint.

      • rateLimit (integer) –

        The maximum request rate per second for the endpoint. The value must be one of the following supported values: 0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, or 10000. The maximum effective value is also bounded by your account-level maximum total rate limit. There is no default value. If you don’t specify a value, the throttling configuration is absent from the response. On an update, omit throttleConfig to keep the current value, or specify an empty object to clear a previously set value.

  • tags (dict) –

    A map of tag keys and values to apply to the web function.

    • (string) –

      • (string) –

Return type:

dict

Returns:

Response Syntax

{
    'functionName': 'string',
    'functionArn': 'string',
    'state': 'Pending'|'Active'|'Failed'|'Deleting',
    'stateReason': 'string',
    'createdAt': datetime(2015, 1, 1),
    'updatedAt': datetime(2015, 1, 1),
    'revision': {
        'revisionArn': 'string',
        'revisionId': 'string',
        'description': 'string',
        'state': 'Pending'|'Active'|'Failed',
        'stateReason': 'string',
        'createdAt': datetime(2015, 1, 1)
    },
    'endpoint': {
        'endpointArn': 'string',
        'endpointName': 'string',
        'description': 'string',
        'endpointType': 'HomeRegion'|'MultiRegion'|'PerRegion',
        'domainName': 'string',
        'authType': 'ApplicationManaged'|'IamAuth',
        'autoDeploymentMode': 'LatestRevision'|'Disabled',
        'revisionWeights': [
            {
                'revisionId': 'string',
                'weight': 123
            },
        ],
        'regions': [
            'string',
        ],
        'scalingConfig': {
            'maxEnvironments': 123
        },
        'throttleConfig': {
            'rateLimit': 123
        },
        'state': 'Pending'|'Active'|'Failed'|'Deleting',
        'stateReason': 'string',
        'updateStatus': 'InProgress'|'Successful'|'Failed',
        'updateStatusReason': 'string',
        'createdAt': datetime(2015, 1, 1),
        'updatedAt': datetime(2015, 1, 1)
    },
    'tags': {
        'string': 'string'
    }
}

Response Structure

  • (dict) –

    Contains details about the created web function.

    • functionName (string) –

      The name of the web function.

    • functionArn (string) –

      The Amazon Resource Name (ARN) of the web function.

    • state (string) –

      The current state of the web function.

    • stateReason (string) –

      The reason for the current state of the web function.

    • createdAt (datetime) –

      The date and time the web function was created.

    • updatedAt (datetime) –

      The date and time the web function was last updated.

    • revision (dict) –

      A summary of the initial revision created with the web function.

      • revisionArn (string) –

        The Amazon Resource Name (ARN) of the revision.

      • revisionId (string) –

        The identifier of the revision.

      • description (string) –

        A description of the revision.

      • state (string) –

        The current state of the revision.

      • stateReason (string) –

        The reason for the current state of the revision.

      • createdAt (datetime) –

        The date and time the revision was created.

    • endpoint (dict) –

      A summary of the initial endpoint created with the web function.

      • endpointArn (string) –

        The Amazon Resource Name (ARN) of the endpoint.

      • endpointName (string) –

        The name of the endpoint.

      • description (string) –

        A description of the endpoint.

      • endpointType (string) –

        The type of the endpoint.

      • domainName (string) –

        The domain name of the endpoint.

      • authType (string) –

        The authorization type for the endpoint.

      • autoDeploymentMode (string) –

        The auto-deployment mode for the endpoint.

      • revisionWeights (list) –

        The revision weights for the endpoint.

        • (dict) –

          Specifies a revision and its traffic weight for an endpoint. You can assign weights to up to two revisions to split traffic for canary or blue-green deployments.

          • revisionId (string) –

            The identifier of the revision.

          • weight (integer) –

            The percentage of traffic to route to this revision. Minimum value of 1, maximum value of 100.

      • regions (list) –

        The list of Regions for the endpoint.

        • (string) –

      • scalingConfig (dict) –

        The scaling configuration for the endpoint. This field is absent if the endpoint has no scaling configuration.

        • maxEnvironments (integer) –

          The maximum number of concurrent execution environments for the endpoint. Minimum value of 2, maximum value of 10000. There is no default value. If you don’t specify a value, the scaling configuration is absent from the response. On an update, omit scalingConfig to keep the current value, or specify an empty object to clear a previously set value.

      • throttleConfig (dict) –

        The throttling configuration for the endpoint. This field is absent if the endpoint has no throttling configuration.

        • rateLimit (integer) –

          The maximum request rate per second for the endpoint. The value must be one of the following supported values: 0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, or 10000. The maximum effective value is also bounded by your account-level maximum total rate limit. There is no default value. If you don’t specify a value, the throttling configuration is absent from the response. On an update, omit throttleConfig to keep the current value, or specify an empty object to clear a previously set value.

      • state (string) –

        The current state of the endpoint.

      • stateReason (string) –

        The reason for the current state of the endpoint.

      • updateStatus (string) –

        The status of the most recent update to the endpoint.

      • updateStatusReason (string) –

        The reason for the current update status of the endpoint.

      • createdAt (datetime) –

        The date and time the endpoint was created.

      • updatedAt (datetime) –

        The date and time the endpoint was last updated.

    • tags (dict) –

      A map of tag keys and values associated with the web function.

      • (string) –

        • (string) –

Exceptions

  • LambdaWeb.Client.exceptions.AccessDeniedException

  • LambdaWeb.Client.exceptions.ConflictException

  • LambdaWeb.Client.exceptions.InternalServerException

  • LambdaWeb.Client.exceptions.ValidationException

  • LambdaWeb.Client.exceptions.ResourceNotFoundException

  • LambdaWeb.Client.exceptions.ThrottlingException

  • LambdaWeb.Client.exceptions.ServiceQuotaExceededException