Sets the maximum number of simultaneous executions for a function, and reserves capacity for that concurrency level.
Concurrency settings apply to the function as a whole, including all published versions and the unpublished version. Reserving concurrency both ensures that your function has capacity to process the specified number of events simultaneously, and prevents it from scaling beyond that level. Use GetFunction to see the current setting for a function.
Use GetAccountSettings to see your Regional concurrency limit. You can reserve concurrency for as many functions as you like, as long as you leave at least 100 simultaneous executions unreserved for functions that aren't configured with a per-function limit. For more information, see Lambda function scaling.
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.
-
reserved_concurrent_executions
(ReservedConcurrentExecutions)
–
The number of simultaneous executions to reserve for the function.
Raises:
Examples:
To configure a reserved concurrency limit for a function
The following example configures 100 reserved concurrent executions for the my-function function.
>>> await client.put_function_concurrency(function_name='my-function', reserved_concurrent_executions=100)
Source code in docs_src/capo_lambda/_services/async__lambda.py
| async def put_function_concurrency(
self,
function_name: "capo_lambda.types.function_name.FunctionName",
reserved_concurrent_executions: "capo_lambda.types.reserved_concurrent_executions.ReservedConcurrentExecutions",
*,
config_overrides: Optional[AsyncLambdaClientConfig] = None,
) -> "capo_lambda.types.concurrency.Concurrency":
"""<p>Sets the maximum number of simultaneous executions for a function, and reserves capacity for that concurrency level.</p> <p>Concurrency settings apply to the function as a whole, including all published versions and the unpublished version. Reserving concurrency both ensures that your function has capacity to process the specified number of events simultaneously, and prevents it from scaling beyond that level. Use <a>GetFunction</a> to see the current setting for a function.</p> <p>Use <a>GetAccountSettings</a> to see your Regional concurrency limit. You can reserve concurrency for as many functions as you like, as long as you leave at least 100 simultaneous executions unreserved for functions that aren't configured with a per-function limit. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-scaling.html">Lambda function scaling</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>
reserved_concurrent_executions: <p>The number of simultaneous executions to reserve for the function.</p>
Raises:
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 configure a reserved concurrency limit for a function
The following example configures 100 reserved concurrent executions for the my-function function.
>>> await client.put_function_concurrency(function_name='my-function', reserved_concurrent_executions=100)
"""
async def _handler(
req: "AsyncOperationRequest[capo_lambda.types.put_function_concurrency_request.PutFunctionConcurrencyRequest]",
) -> AsyncOperationResponse["capo_lambda.types.concurrency.Concurrency"]:
import capo_lambda._operations.aws_gir_api_service.put_function_concurrency
(
output,
http_response,
) = await capo_lambda._operations.aws_gir_api_service.put_function_concurrency.async_put_function_concurrency(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("PutFunctionConcurrency")
)
input_: capo_lambda.types.put_function_concurrency_request.PutFunctionConcurrencyRequest = {
"function_name": function_name,
"reserved_concurrent_executions": reserved_concurrent_executions,
}
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|