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
CreateWebFunctionpermission 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, '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 length constraint applies only to the full ARN. If you specify only the function name, it 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. Must be between 3 and 63 characters.
key (string) – [REQUIRED]
The Amazon S3 object key. Must be between 1 and 1024 characters.
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.
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 length constraint applies only to the full ARN. If you specify only the endpoint name, it 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.
authType (string) – [REQUIRED]
The authorization type for the endpoint.
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.regions (list) –
The list of Regions for the endpoint. Required when the endpoint type is
MultiRegionorPerRegion: 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 isHomeRegion, 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
scalingConfigto 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, or10000. 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, omitthrottleConfigto 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. Up to two revisions can be assigned weights 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
scalingConfigto 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, or10000. 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, omitthrottleConfigto 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.AccessDeniedExceptionLambdaWeb.Client.exceptions.ConflictExceptionLambdaWeb.Client.exceptions.InternalServerExceptionLambdaWeb.Client.exceptions.ValidationExceptionLambdaWeb.Client.exceptions.ResourceNotFoundExceptionLambdaWeb.Client.exceptions.ThrottlingExceptionLambdaWeb.Client.exceptions.ServiceQuotaExceededException