title: Unexplainable AmazonS3Client getObject() 403 AccessDenied exception
body: <p>Using the java Amazon AWS SDK, I am getting an unexplainable 403 AccessDenied exception when calling the <code>AmazonS3Client.getObject()</code> method. What is odd here is that I am uploading the object with the same <code>AmazonS3Client</code> so the object resource owner should be the same.</p>
  
  <pre><code>    ClientConfiguration config = new ClientConfiguration();
      config.setProtocol(Protocol.HTTP); // TODO Change to HTTPS?
      AWSCredentials awsCredentials = new BasicAWSCredentials("myAccessKeyID","mySecretAccessKey");
      AmazonS3 amazonS3 = new AmazonS3Client(awsCredentials, config);
      amazonS3.setEndpoint(serviceInfo.getHost());
      S3ClientOptions options = new S3ClientOptions();
      options.setPathStyleAccess(true);
      amazonS3.setS3ClientOptions(options);
  
      amazonS3.putObject(“myBucket”, “keyVal”, file);
      amazonS3.getObject(“myBucket”, “keyVal”); //AccessDenied
  </code></pre>
  
  <p>Even if I specify an ACL with the <code>putObject()</code> call, I still get the AccessDenied exception.</p>
  
  <pre><code>Owner owner = amazonS3.getS3AccountOwner();
  AccessControlList acl = new AccessControlList();
  acl.grantPermission(new CanonicalGrantee(owner.getId()), Permission.Read);
  amazonS3.putObject(new PutObjectRequest("mybucket", "myKey", f).withAccessControlList(acl));
  amazonS3.getObject(“myBucket”, “keyVal”); //AccessDenied Still!!!
  </code></pre>
  
  <p>I’ve tested this by including an ACL with Grantee ALL_USERS to the <code>amazonS3.putObject()</code> call and this allows me to use the <code>amazonS3.getObject()</code> call okay without any exceptions so it seems like a permissions issue somewhere. But where?!</p>
  
  <p>The Amazon docs specifically say that a resource owner has access to the resource:
  "By default, all Amazon S3 resources—buckets, objects, and related subresources (for example, lifecycle configuration and website configuration)—are private: only the resource owner, an AWS account that created it, can access the resource.”</p>
  
  <p><strong>Edit</strong></p>
  
  <p>I should have mentioned originally that I am using the RiakCS client to connect to S3. At the time of this edit, it seems to be an issue with RiakCS.</p>