From 130b0a755d8515ebd1dbf479b0148cdfc3c40ba1 Mon Sep 17 00:00:00 2001 From: guyrenny Date: Mon, 1 Jul 2024 14:16:50 +0300 Subject: [PATCH] add new variable to determen the aws api requests limit --- src/lambda-manager/lambda_function.py | 4 ++-- src/lambda-manager/template.yaml | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lambda-manager/lambda_function.py b/src/lambda-manager/lambda_function.py index 014ee96..94e9212 100644 --- a/src/lambda-manager/lambda_function.py +++ b/src/lambda-manager/lambda_function.py @@ -6,8 +6,8 @@ from botocore.config import Config config = Config( - retries = { - 'max_attempts': 10, + retries = { + 'max_attempts': int(os.environ.get('AWS_API_REUESTS_LIMIT', 10)), 'mode': 'standard' } ) diff --git a/src/lambda-manager/template.yaml b/src/lambda-manager/template.yaml index 126ca6d..d1f0845 100644 --- a/src/lambda-manager/template.yaml +++ b/src/lambda-manager/template.yaml @@ -62,6 +62,10 @@ Parameters: Type: String Description: instead creating one permission for each log group in the destination lambda, the code will take the prefix that you set in the parameter and create 1 permission for all of the log groups that match the prefix Default: "" + AWSApiRequestsLimit: + Type: Number + Description: In case you got an error in the lambda which is related to ThrottlingException, then you can increase the limit of the requests that the lambda can do to the AWS API. + Default: 10 FunctionMemorySize: Type: Number Description: Lambda function memory limit @@ -138,6 +142,8 @@ Resources: Ref: ScanOldLogGroups LOG_GROUP_PERMISSION_PREFIX: Ref: LogGroupPermissionPreFix + AWS_API_REUESTS_LIMIT: + Ref: AWSApiRequestsLimit Policies: - Statement: - Sid: CXLambdaUpdateConfig