Hitachi Content Platform​

 View Only

 Enabling "s3:ListBucket" Permissions

  • Object Storage
  • Hitachi Content Platform HCP
Paul Cherrier's profile image
Paul Cherrier posted 03-11-2020 15:32

I am writing an app that utilizes the aws-java-sdk/sts libraries and have run into the issue where I cannot List any of the items in a bucket. I can create a bucket, write a file, and read a file with a hard coded path but I cannot run any list commands.

 

https://stackoverflow.com/questions/60624088/amazons3-sdk-access-denied-when-listing-objects

 

How do I enable this permission in the HCP console? This is what I see for the user (using a self signed cert HTTPS):

 

 

Reference: https://aws.amazon.com/premiumsupport/knowledge-center/s3-access-denied-listobjects-sync/

 

 


#HitachiContentPlatformHCP
Joshua Eddy's profile image
Joshua Eddy

According to the HCP documentation [Using the Hitachi API for Amazon S3 > Working with buckets > Listing bucket contents (version 2)] , "You use the HTTP GET method to list the contents of a bucket. To list the contents of a bucket, you need browse permission for the bucket. You do not need to be an authenticated user."

 

So you should check whether the SDK is using GET method or something else.

And you should check whether you have browse permission for the bucket.

If everything is set as expected, consider contacting your account team or technical support.

 

The HCP documentation [Using the Hitachi API for Amazon S3 > Bucket and object properties > Access control lists > ACL permissions] indicates that "Read" and "Full control" ACLs provide browse permission.

 

The HCP documentation section [Using the Hitachi API for Amazon S3 > Bucket and object properties > Access control lists > Specifying ACLs] explains how to set the ACLs.

Michal Marek's profile image
Michal Marek

Hi,

i do the same differently. Using S3 you don't need parsing XML. Maybe mismatch in included libraries. Here is snippet of my code:

 

 if (!QUERY) {

      objectListing = hs3Client.listObjects(new ListObjectsRequest().withBucketName(bucketName));

  }

  else {

      objectListing = hs3Client.listObjects(new ListObjectsRequest().withBucketName(bucketName).withPrefix(objNamePrefix));

  }

 

      for (S3ObjectSummary objectSummary : objectListing.getObjectSummaries()) {

   String objKey = objectSummary.getKey();

       System.out.println(" * " + objKey);

   long objSize = objectSummary.getSize(); 

   System.out.println("\tSize        = " + objSize);

   System.out.println("\tLastModified [UTC] = " + sdf.format(objectSummary.getLastModified()));

   System.out.println("\tMD5         = " + objectSummary.getETag()); 

   System.out.println("\tOwner        = " + objectSummary.getOwner());

   System.out.println("\tStorageClass    = " + objectSummary.getStorageClass()); 

   // System.out.println("\tResourceURL     = " + hs3Client.getResourceUrl(bucketName,objKey)); 4 deprecated hs3Client

   System.out.println("\tURL         = " + hs3Client.getUrl(bucketName,objKey));

   System.out.println("\t*"); 

 

    

   ObjectMetadata objmetaData = hs3Client.getObjectMetadata(bucketName,objKey);

 

   Map<String, Object> metaMap = objmetaData.getRawMetadata();

   metaMap.forEach((key,value) -> System.out.println("\tRawMetadata     = " + key + ":\t" + value));

    

   //System.out.println("\tReplication Status  = " + objmetaData.getRawMetadataValue(OBJECT_REPLICATION_STATUS));

   //System.out.println("\tReplication Status  = " + objmetaData.getReplicationStatus());

 

   System.out.println("\t*");

    

   Iterator entries = objmetaData.getUserMetadata().entrySet().iterator();

 

   while (entries.hasNext()) {

      Entry entr = (Entry) entries.next();

      System.out.println("\tUserMetadata    = " + entr.getKey() + ":\t" + entr.getValue());

   }

 

   //Get Raw metadata

           //Map(String, Object) = objmetadata.getRawMetadata();

      }

 

Regards.

Michal