Skip to content

Commit c562623

Browse files
committed
test fix for regional sts endpoint issue
1 parent a8890c9 commit c562623

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

aws_sra_examples/solutions/guardduty/guardduty_org/lambda/src/common.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ def assume_role(role: str, role_session_name: str, account: str = None, session:
5353
Returns:
5454
Session object for the specified AWS account
5555
"""
56+
# TODO(liamschn): move this to correct place
57+
os.environ["AWS_STS_REGIONAL_ENDPOINTS"] = "regional"
58+
5659
if not session:
5760
session = boto3.Session()
5861
sts_client: STSClient = session.client("sts", config=BOTO3_CONFIG)

aws_sra_examples/solutions/guardduty/guardduty_org/lambda/src/guardduty.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import json
1414
import logging
1515
import math
16+
import os
1617
from time import sleep
1718
from typing import TYPE_CHECKING, Any, Dict
1819

@@ -404,7 +405,7 @@ def set_org_configuration_params(detector_id: str, gd_features: dict) -> dict:
404405
"DetectorId": detector_id,
405406
"AutoEnable": True,
406407
"Features": features_config,
407-
"AutoEnableOrganizationMembers": "ALL",
408+
# "AutoEnableOrganizationMembers": "ALL",
408409
}
409410
name = ""
410411
auto_enable_type = ""
@@ -503,6 +504,10 @@ def configure_guardduty( # noqa: CFQ002, CFQ001
503504

504505
# Loop through the regions and enable GuardDuty
505506
for region in region_list:
507+
# if region == "ap-southeast-4":
508+
# LOGGER.info(f"skipping ap-southeast-4")
509+
# else:
510+
LOGGER.info(f"Configuring GuardDuty in {region}")
506511
regional_guardduty: GuardDutyClient = session.client("guardduty", region_name=region, config=BOTO3_CONFIG)
507512
detectors = regional_guardduty.list_detectors()
508513

0 commit comments

Comments
 (0)