Software Development Kit (SDK) and API Discussions

Getting an UnknownHostException when trying to do a createBucket or putObject

tlmitch
63 Views

Hello,

I have a java app in which I'm trying to interface with a NetApp S3 API gateway in order to store large files there.

 

It was pretty straightforward to make a connection with an S3Client.

And I know that I set things up correctly because I'm able to do a listBuckets and it correctly lists all of the existing buckets.

 

 
    String accessKeyId = "MyAccessKeyID";
    String secretAccesskey = "MySecretAccessKey";
    String endpointUrl = "https://theendpointurltomynetappstoragegrid:10444";

    StaticCredentialsProvider credentialsProvider = StaticCredentialsProvider.create(
                AwsBasicCredentials.create(accessKeyId, secretAccesskey));
        
    // Create S3 client
    S3Client s3Client = S3Client.builder()
            .credentialsProvider(credentialsProvider)
            .region(Region.US_EAST_1)
            .endpointOverride(URI.create(endpointUrl))
            .overrideConfiguration(ClientOverrideConfiguration.builder()
            .build())
        .build();

    //This actually works fine to list the buckets - indicating I am connecting fine
    ListBucketsResponse listBucketsResponse = s3Client.listBuckets();

   

However it crashes with the UnknownHostException when I try to do a createBucket or postObject.

 

    CreateBucketRequest createBucketRequest = CreateBucketRequest.builder()
                            .bucket("testbucket11")
                            .build();

    //However this always crashes with a SdkClientException: Received an UnknownHostException
    s3Client.createBucket(createBucketRequest);

 

BTW I am able to do a create-bucket through the aws command-line interface.

This actually does create a bucket.

aws --endpoint-url https://theendpointurltomynetappstoragegrid:10444 s3api create-bucket --bucket testbucket11

 

Any suggestions?  Thank you.

0 REPLIES 0
Public