@@ -66,10 +66,14 @@ def get_api_key() -> str:
66
66
67
67
REGION = os .environ .get ("AWS_REGION" , "" )
68
68
is_gov_region = REGION .startswith ("us-gov-" )
69
+ use_non_fips_endpoints = os .environ .get ("DD_AWS_USE_NON_FIPS_ENDPOINTS" , "" ).lower () == "true"
69
70
70
71
if DD_API_KEY_SECRET_ARN :
71
- # Secrets manager endpoints: https://docs.aws.amazon.com/general/latest/gr/asm.html
72
- fips_endpoint = f"https://secretsmanager-fips.{ REGION } .amazonaws.com" if is_gov_region else None
72
+ if is_gov_region and not use_non_fips_endpoints :
73
+ # Secrets manager endpoints: https://docs.aws.amazon.com/general/latest/gr/asm.html
74
+ fips_endpoint = f"https://secretsmanager-fips.{ REGION } .amazonaws.com"
75
+ else :
76
+ fips_endpoint = None
73
77
secrets_manager_client = boto3 .client (
74
78
"secretsmanager" ,
75
79
endpoint_url = fips_endpoint
@@ -78,8 +82,11 @@ def get_api_key() -> str:
78
82
SecretId = DD_API_KEY_SECRET_ARN
79
83
)["SecretString" ]
80
84
elif DD_API_KEY_SSM_NAME :
81
- # SSM endpoints: https://docs.aws.amazon.com/general/latest/gr/ssm.html
82
- fips_endpoint = f"https://ssm-fips.{ REGION } .amazonaws.com" if is_gov_region else None
85
+ if is_gov_region and not use_non_fips_endpoints :
86
+ # SSM endpoints: https://docs.aws.amazon.com/general/latest/gr/ssm.html
87
+ fips_endpoint = f"https://ssm-fips.{ REGION } .amazonaws.com"
88
+ else :
89
+ fips_endpoint = None
83
90
ssm_client = boto3 .client (
84
91
"ssm" ,
85
92
endpoint_url = fips_endpoint
@@ -88,8 +95,11 @@ def get_api_key() -> str:
88
95
Name = DD_API_KEY_SSM_NAME , WithDecryption = True
89
96
)["Parameter" ]["Value" ]
90
97
elif DD_KMS_API_KEY :
91
- # KMS endpoints: https://docs.aws.amazon.com/general/latest/gr/kms.html
92
- fips_endpoint = f"https://kms-fips.{ REGION } .amazonaws.com" if is_gov_region else None
98
+ if is_gov_region and not use_non_fips_endpoints :
99
+ # KMS endpoints: https://docs.aws.amazon.com/general/latest/gr/kms.html
100
+ fips_endpoint = f"https://kms-fips.{ REGION } .amazonaws.com"
101
+ else :
102
+ fips_endpoint = None
93
103
kms_client = boto3 .client (
94
104
"kms" ,
95
105
endpoint_url = fips_endpoint
0 commit comments