SdkClientException: Unable to load credentials from service endpoint.
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.
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
i solved it. when i do like this
but. anybody can tell me why? this is my first time use aws..
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.
thanks.. but vpc and security group works normally.. when i changed my code like this
everything is settled.Whether I should configure something on the “idea”
@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?
The comment part is the original code, but the current code is not commented
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.
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.