Skip to content

Commit 0fad6b8

Browse files
Adding boto3 retry for large quicksight groups throttling fault tolerance and Increasing timeout to 15 mins in lambda (#364)
1 parent 46621ec commit 0fad6b8

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

data-collection/deploy/module-quicksight.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ Resources:
131131
import datetime
132132
from json import JSONEncoder
133133
import boto3
134+
from botocore.config import Config
134135
135136
BUCKET = os.environ["BUCKET_NAME"]
136137
PREFIX = os.environ["PREFIX"]
@@ -139,6 +140,13 @@ Resources:
139140
logger = logging.getLogger(__name__)
140141
logger.setLevel(getattr(logging, os.environ.get('LOG_LEVEL', 'INFO').upper(), logging.INFO))
141142
143+
config = Config(
144+
retries = {
145+
'max_attempts': 10,
146+
'mode': 'standard'
147+
}
148+
)
149+
142150
class DateTimeEncoder(JSONEncoder):
143151
"""encoder for json with time object"""
144152
def default(self, o):
@@ -151,7 +159,7 @@ Resources:
151159
"""Starting Point for Lambda"""
152160
account_id = context.invoked_function_arn.split(":")[4]
153161
logger.debug("Collecting data for account: %s", account_id)
154-
quicksight_client = boto3.client("quicksight")
162+
quicksight_client = boto3.client("quicksight", config=config)
155163
namespaces = list_namespaces(account_id=account_id, quicksight=quicksight_client)
156164
157165
users = []
@@ -272,7 +280,7 @@ Resources:
272280
logger.info("Quicksight data for %s stored at s3://%s/%s", account_id, BUCKET, key)
273281
Handler: 'index.lambda_handler'
274282
MemorySize: 2688
275-
Timeout: 300
283+
Timeout: 900
276284
Role: !GetAtt LambdaRole.Arn
277285
Environment:
278286
Variables:

0 commit comments

Comments
 (0)