Skip to content

Commit 43d7d05

Browse files
committed
Fix jump role manager AWS Organizations API retries
## Why? When multiple accounts are bootstrapped by ADF via changes in the AWS Oranizations hierarchy, the jump-role-manager could run into rate limits of the AWS Organizations API. ## What? This change will ensure that the lambda function will retry more often. While using exponential back-off and jitter as built-in by boto3 and as configured in the Step Function retry logic.
1 parent 74329ab commit 43d7d05

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/lambda_codebase/jump_role_manager/main.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
from aws_xray_sdk.core import patch_all
3434
import boto3
35+
from botocore.config import Config
3536
from botocore.exceptions import ClientError
3637

3738
# ADF imports
@@ -79,8 +80,13 @@
7980
/ CHARS_PER_ACCOUNT_ID,
8081
)
8182

83+
BOTO_ORG_CONFIG = Config(
84+
retries={
85+
"max_attempts": 15,
86+
},
87+
)
8288
IAM_CLIENT = boto3.client("iam")
83-
ORGANIZATIONS_CLIENT = boto3.client("organizations")
89+
ORGANIZATIONS_CLIENT = boto3.client("organizations", config=BOTO_ORG_CONFIG)
8490
TAGGING_CLIENT = boto3.client("resourcegroupstaggingapi")
8591
CODEPIPELINE_CLIENT = boto3.client("codepipeline")
8692

src/template.yml

+5
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,11 @@ Resources:
920920
"TimeoutSeconds": 300,
921921
"Retry": [
922922
{
923+
"ErrorEquals": ["States.TaskFailed"],
924+
"IntervalSeconds": 3,
925+
"BackoffRate": 2,
926+
"MaxAttempts": 10
927+
}, {
923928
"ErrorEquals": [
924929
"Lambda.Unknown",
925930
"Lambda.ServiceException",

0 commit comments

Comments
 (0)