aws-sdk-java icon indicating copy to clipboard operation
aws-sdk-java copied to clipboard

SdkClientException: Unable to load credentials from service endpoint.

Open SakuraLxm opened this issue 3 years ago • 4 comments

Describe the issue

! java.net.SocketTimeoutException: Connect timed out ! at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:546) ! at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:597) ! at java.base/java.net.Socket.connect(Socket.java:633) ! at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:178) ! at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:532) ! at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:637) ! at java.base/sun.net.www.http.HttpClient.(HttpClient.java:280) ! at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:385) ! at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:407) ! at java.base/sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1309) ! at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1287) ! at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1128) ! at java.base/sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:1057) ! at software.amazon.awssdk.regions.internal.util.ConnectionUtils.connectToEndpoint(ConnectionUtils.java:45) ! at software.amazon.awssdk.regions.util.HttpResourcesUtils.readResource(HttpResourcesUtils.java:112) ! at software.amazon.awssdk.regions.util.HttpResourcesUtils.readResource(HttpResourcesUtils.java:91) ! at software.amazon.awssdk.auth.credentials.InstanceProfileCredentialsProvider$InstanceProviderCredentialsEndpointProvider.endpoint

i can see my table by awstools which create by my project.but,when i running my project it make err.. i also use vpn and config targeD 0.0.0.0/0 ,i can also connet my redis .. i dont know why

Links

image image image

SakuraLxm avatar Sep 19 '22 13:09 SakuraLxm

image

SakuraLxm avatar Sep 19 '22 13:09 SakuraLxm

i solved it. when i do like this image but. anybody can tell me why? this is my first time use aws..

SakuraLxm avatar Sep 20 '22 19:09 SakuraLxm

I can't say for sure since some things are defined outside of the code samples you provided (like config) but I'll say that probably InstanceProfileCredentialsProvider was not reaching the IMDS endpoint, due to a misconfigured vpc or security group.

debora-ito avatar Sep 20 '22 21:09 debora-ito

thanks.. but vpc and security group works normally.. when i changed my code like this image everything is settled.Whether I should configure something on the “idea”

SakuraLxm avatar Sep 21 '22 03:09 SakuraLxm

@SakuraLxm I'm sorry but I don't fully understand your question based on the screenshots. If you provide a full reproducible code it may be easier. How was the code before? What exactly did you change to?

debora-ito avatar Sep 26 '22 18:09 debora-ito

The comment part is the original code, but the current code is not commented

SakuraLxm avatar Sep 28 '22 03:09 SakuraLxm

If your application is running in EC2 and InstanceProfileCredentialsProvider is throwing Connect timed out it's an indication that the client timed out when connecting to the EC2 IMDS endpoint.

You can check if the endpoint is reachable from the EC2 instance by manually running the CURL commands listed here: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html

If it is not reachable, check the networking configuration of the EC2 instance.

This is likely not an issue with the SDK, so I'll go ahead and close this. Feel free to reach out if you have any other question.

debora-ito avatar Sep 28 '22 18:09 debora-ito

COMMENT VISIBILITY WARNING

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. If you wish to keep having a conversation with other community members under this issue feel free to do so.

github-actions[bot] avatar Sep 28 '22 18:09 github-actions[bot]