Skip to content

Instantly share code, notes, and snippets.

@filipeandre
Created July 16, 2025 15:38
Show Gist options
  • Save filipeandre/be533028b637f20b9e65de43a27e3024 to your computer and use it in GitHub Desktop.
Save filipeandre/be533028b637f20b9e65de43a27e3024 to your computer and use it in GitHub Desktop.
Force lambda concurrent executions quota increase
import boto3
import json
import multiprocessing
from botocore.exceptions import ClientError
function_name = "hello-world-quota-limit"
payload = {
"key1": "test-key1",
"key2": "test-key2",
"key3": "test-key3"
}
payload_bytes = json.dumps(payload).encode()
def invoke_lambda(index):
try:
client = boto3.client("lambda")
response = client.invoke(
FunctionName=function_name,
InvocationType="RequestResponse",
Payload=payload_bytes
)
status = response["ResponseMetadata"]["HTTPStatusCode"]
result_raw = response["Payload"].read().decode()
try:
result = json.loads(result_raw)
except json.JSONDecodeError:
result = result_raw
print(f"[{index}] ✅ HTTP {status} | result: {result}")
return (status, result)
except ClientError as e:
code = e.response["Error"]["Code"]
print(f"[{index}] ❌ ClientError: {code}")
return (code, None)
except Exception as e:
print(f"[{index}] ❌ Exception: {e}")
return (None, str(e))
if __name__ == "__main__":
total = 50 # Number of concurrent invocations
with multiprocessing.Pool(processes=total) as pool:
results = pool.map(invoke_lambda, range(1, total + 1))
throttled = sum(1 for status, _ in results if status == "TooManyRequestsException")
ok = sum(1 for status, _ in results if status == 200)
print(f"\nSUMMARY:\n✅ Success: {ok} / {total}\n🚫 Throttled: {throttled} / {total}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment