Skip to content

Run IAMClient met exception : Unable to execute HTTP request: iam.us-east-1.amazonaws.com #206

Description

@xuzhang101

Current Behavior

Create IAMClient with the code below :
IAMClient.builder()
.overrideConfiguration(clientConfiguration)
.region(region)
.endpointOverride(URI.create("https://iam.amazonaws.com"))
.build();
When I run the IAMClient, I met the exception
software.amazon.awssdk.SdkClientException: Unable to execute HTTP request: iam.us-east-1.amazonaws.com at software.amazon.awssdk.http.pipeline.stages.RetryableStage$RetryExecutor.handleThrownException(RetryableStage.java:212)

I applied a workaround solution
IAMClient.builder()
.overrideConfiguration(clientConfiguration)
.region(region)
.credentialsProvider(new SystemPropertyCredentialsProvider())
.endpointOverride(iamURI)
.build();

Then, I met another exception :
software.amazon.awssdk.services.iam.model.IAMException: Credential should be scoped to a valid region, not 'eu-west-1'. (Service: IAMClient; Status Code: 403; Error Code: SignatureDoesNotMatch; Request ID: c2ce17d7-ae81-11e7-a24f-d5e0ad542460)
at software.amazon.awssdk.http.pipeline.stages.HandleResponseStage.handleErrorResponse(HandleResponseStage.java:117)
at software.amazon.awssdk.http.pipeline.stages.HandleResponseStage.handleResponse(HandleResponseStage.java:73)
at software.amazon.awssdk.http.pipeline.stages.HandleResponseStage.execute(HandleResponseStage.java:58)

The credentials was already set
System.setProperty("aws.accessKeyId", accessKey);
System.setProperty("aws.secretAccessKey", secretKey);

  • AWS Java SDK version used:
    2.0.0-preview-4
  • JDK version used:
    java 1.8
  • Operating System and version:
    Windows 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestA feature should be added or improved.p3This is a minor priority issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions