diff --git a/botocore/args.py b/botocore/args.py index aeb9ff4198..8151ec8020 100644 --- a/botocore/args.py +++ b/botocore/args.py @@ -453,7 +453,7 @@ def _get_sts_regional_endpoints_config(self): 'sts_regional_endpoints' ) if not sts_regional_endpoints_config: - sts_regional_endpoints_config = 'legacy' + sts_regional_endpoints_config = 'regional' if ( sts_regional_endpoints_config not in VALID_REGIONAL_ENDPOINTS_CONFIG diff --git a/tests/unit/test_args.py b/tests/unit/test_args.py index 9338b05371..f2b22be207 100644 --- a/tests/unit/test_args.py +++ b/tests/unit/test_args.py @@ -393,18 +393,21 @@ def test_sts_http_scheme_for_override_endpoint(self): client_args['endpoint'].host, 'http://sts.amazonaws.com' ) - def test_sts_regional_endpoints_defaults_to_legacy_if_not_set(self): + def test_sts_regional_endpoints_defaults_to_regional_if_not_set(self): + resolved_endpoint = 'https://resolved-endpoint' + resolved_region = 'resolved-region' + self._set_endpoint_bridge_resolve( + endpoint_url=resolved_endpoint, signing_region=resolved_region + ) self.config_store.set_config_variable('sts_regional_endpoints', None) client_args = self.call_get_client_args( service_model=self._get_service_model('sts'), region_name='us-west-2', endpoint_url=None, ) + self.assertEqual(client_args['endpoint'].host, resolved_endpoint) self.assertEqual( - client_args['endpoint'].host, 'https://sts.amazonaws.com' - ) - self.assertEqual( - client_args['request_signer'].region_name, 'us-east-1' + client_args['request_signer'].region_name, resolved_region ) def test_invalid_sts_regional_endpoints(self): @@ -669,7 +672,7 @@ def test_builtins_defaults(self): self.assertEqual(bins['AWS::Region'], 'ca-central-1') self.assertEqual(bins['AWS::UseFIPS'], False) self.assertEqual(bins['AWS::UseDualStack'], False) - self.assertEqual(bins['AWS::STS::UseGlobalEndpoint'], True) + self.assertEqual(bins['AWS::STS::UseGlobalEndpoint'], False) self.assertEqual(bins['AWS::S3::UseGlobalEndpoint'], False) self.assertEqual(bins['AWS::S3::Accelerate'], False) self.assertEqual(bins['AWS::S3::ForcePathStyle'], False) @@ -723,7 +726,7 @@ def test_aws_sts_global_endpoint_with_default_and_legacy_region(self): bins = self.call_compute_endpoint_resolver_builtin_defaults( region_name='us-west-2', ) - self.assertEqual(bins['AWS::STS::UseGlobalEndpoint'], True) + self.assertEqual(bins['AWS::STS::UseGlobalEndpoint'], False) def test_aws_sts_global_endpoint_with_default_and_nonlegacy_region(self): bins = self.call_compute_endpoint_resolver_builtin_defaults(