Skip to content

Commit 61b0a87

Browse files
author
Bob Strahan
committed
Fix BDA profile ARN generation for multi-region support
1 parent 52ccd01 commit 61b0a87

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

lib/idp_common_pkg/idp_common/bda/bda_service.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,12 @@ def __init__(
2929
region = os.environ.get("AWS_REGION", "us-east-1")
3030
identity = session.client("sts").get_caller_identity()
3131
account_id = identity.get("Account")
32-
self._dataAutomationProfileArn = f"arn:aws:bedrock:{region}:{account_id}:data-automation-profile/us.data-automation-v1"
32+
33+
# Extract region prefix (us, eu, ap, ca, sa, etc.) for profile ARN
34+
region_prefix = region.split("-")[0]
35+
profile_id = f"{region_prefix}.data-automation-v1"
36+
37+
self._dataAutomationProfileArn = f"arn:aws:bedrock:{region}:{account_id}:data-automation-profile/{profile_id}"
3338

3439
self._bda_client = boto3.client("bedrock-data-automation-runtime")
3540

patterns/pattern-1/template.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -744,10 +744,7 @@ Resources:
744744
Action: bedrock:InvokeDataAutomationAsync
745745
Resource:
746746
- !Ref BDAProjectArn
747-
- !Sub "arn:${AWS::Partition}:bedrock:us-east-1:${AWS::AccountId}:data-automation-profile/us.data-automation-v1"
748-
- !Sub "arn:${AWS::Partition}:bedrock:us-east-2:${AWS::AccountId}:data-automation-profile/us.data-automation-v1"
749-
- !Sub "arn:${AWS::Partition}:bedrock:us-west-1:${AWS::AccountId}:data-automation-profile/us.data-automation-v1"
750-
- !Sub "arn:${AWS::Partition}:bedrock:us-west-2:${AWS::AccountId}:data-automation-profile/us.data-automation-v1"
747+
- !Sub "arn:${AWS::Partition}:bedrock:*:${AWS::AccountId}:data-automation-profile/*.data-automation-v1"
751748

752749
InvokeBDAFunctionLogGroup:
753750
Type: AWS::Logs::LogGroup

0 commit comments

Comments
 (0)