Localstack AWS KMS region only support is not working #7542
ramprasad1996
started this conversation in
General
Replies: 1 comment
-
In order to connect to LocalStack you need to set the endpoint. This is required. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I'm using the localstack testcontainer to mock the KMS calls from my application. The existing code in my app uses only the region, and it works fine when communicating with AWS.
AWSKMSClientBuilder.standard()
.withRegion(Regions.fromName(region))
.withCredentials(new AWSStaticCredentialsProvider(basicCredentials)).build();
But when I use the localstack params to the builder object, it still calls AWS -
https://kms.us-east-1.amazonaws.com/ which is failing with an invalid client exception.
AWSKMSClientBuilder.standard()
.withRegion(Regions.fromName(localstack.getRegion())
.withCredentials(new AWSStaticCredentialsProvider(basicCredentials)).build();
However when i use the endpoint config builder method instead of region , it makes the call to localstack and works fine.
AWSKMSClientBuilder.standard()
.withEndpointConfiguration(
new AwsClientBuilder.EndpointConfiguration(
localstack.getEndpoint().toString(),
localstack.getRegion()
))
Do you know why when region and credentials alone are given, it makes the call to AWS? The AWSKMSClientBuilder doesn't allow to use of both region and endpointconfiguration in the same builder object. Is there any workaround for this, other than using the withEndpointConfiguration instead of region?
Any help is appreciated. Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions