putFunctionConcurrency method
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 Managing Concurrency.
May throw ServiceException. May throw InvalidParameterValueException. May throw ResourceNotFoundException. May throw TooManyRequestsException. May throw ResourceConflictException.
Parameter functionName
:
The name 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
.
Parameter reservedConcurrentExecutions
:
The number of simultaneous executions to reserve for the function.
Implementation
Future<Concurrency> putFunctionConcurrency({
required String functionName,
required int reservedConcurrentExecutions,
}) async {
ArgumentError.checkNotNull(functionName, 'functionName');
_s.validateStringLength(
'functionName',
functionName,
1,
140,
isRequired: true,
);
ArgumentError.checkNotNull(
reservedConcurrentExecutions, 'reservedConcurrentExecutions');
_s.validateNumRange(
'reservedConcurrentExecutions',
reservedConcurrentExecutions,
0,
1152921504606846976,
isRequired: true,
);
final $payload = <String, dynamic>{
'ReservedConcurrentExecutions': reservedConcurrentExecutions,
};
final response = await _protocol.send(
payload: $payload,
method: 'PUT',
requestUri:
'/2017-10-31/functions/${Uri.encodeComponent(functionName)}/concurrency',
exceptionFnMap: _exceptionFns,
);
return Concurrency.fromJson(response);
}