Use Resource Path Addressing

To configure the AWS Java SDK to use Resource Path Addressing instead of virtual host addressing, either:

  • Set the disableDNSBuckets system property to True:
    
    Example: Setting the disableDNSBuckets System Property Separately
    
    System.setProperty("com.amazonaws.sdk.disableDNSBuckets", "True");
    
  • Set the withPathStyleAccess property of the AmazonS3Client.S3ClientOptions to True:
    
    Example: Setting the withPathStyleAccess Property when Opening the Connection
    
    AmazonS3 s3 = new AmazonS3Client(credentials);
    
    S3ClientOptions opts = new S3ClientOptions().withPathStyleAccess(true);
    s3.setS3ClientOptions(opts);