You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the SDK is using this profile as the active profile, the endpoint_url property is ignored by the SDK. When service endpoints are resolved, they are resolved to their respective defaults, although the region property is used as expected.
For example, using such a configuration results in an SQS endpoint of https://sqs.us-west-1.amazonaws.com
This is contrary to the behavior of the AWS CLI which uses the property correctly.
Expected Behavior
When the active profile specifies an endpoint_url, SDK endpoint resolution for AWS services should use the endpoint_url
package org.example;
import java.util.concurrent.ExecutionException;
import software.amazon.awssdk.services.sqs.SqsAsyncClient;
public class Main {
public static void main(String[] args) {
// For example purposes so that it can be resolved
System.setProperty("aws.profile", "localstack");
try (SqsAsyncClient client = SqsAsyncClient.create()) {
client.listQueues().get();
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
}
}
You will get an error Caused by: software.amazon.awssdk.services.sqs.model.SqsException: The security token included in the request is invalid. (Service: Sqs, Status Code: 403, Request ID: 360407ba-8ce1-5488-a853-589605d82591) since it is using the default endpoint and not the one specified in the profile.
This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.
Describe the bug
When you specify a profile under
~/.aws/config
such as:When the SDK is using this profile as the active profile, the
endpoint_url
property is ignored by the SDK. When service endpoints are resolved, they are resolved to their respective defaults, although the region property is used as expected.For example, using such a configuration results in an SQS endpoint of
https://sqs.us-west-1.amazonaws.com
This is contrary to the behavior of the AWS CLI which uses the property correctly.
Expected Behavior
When the active profile specifies an
endpoint_url
, SDK endpoint resolution for AWS services should use theendpoint_url
Current Behavior
The
endpoint_url
property is ignored.You can see the actual endpoint being used is
sqs.us-west-1.amazonaws.com
Reproduction Steps
Create an
~/.aws/config
file:Create an
~/.aws/credentials
file:Run the following code:
You will get an error
Caused by: software.amazon.awssdk.services.sqs.model.SqsException: The security token included in the request is invalid. (Service: Sqs, Status Code: 403, Request ID: 360407ba-8ce1-5488-a853-589605d82591)
since it is using the default endpoint and not the one specified in the profile.Possible Solution
No response
Additional Information/Context
https://aws.amazon.com/blogs/developer/new-improved-flexibility-when-configuring-endpoint-urls-with-the-aws-sdks-and-tools/
AWS Java SDK version used
2.21.46 (applies to 2.26.31)
JDK version used
openjdk 21.0.2 2024-01-16
Operating System and version
MacOS 14.3
The text was updated successfully, but these errors were encountered: