amazon web services - AWS S3 Java SDK - Access Denied -


i trying access bucket , object using aws sdk while running code getting error exception in thread "main" com.amazonaws.services.s3.model.amazons3exception: access denied (service: amazon s3; status code: 403; error code: accessdenied; request id: x), s3 extended request id: y=

kindly suggest, lacking , why access denied error occurring although have taken following permission bucket:

s3:getobject s3:getobjectversion s3:getobjectacl s3:getbucketacl s3:getbucketcors s3:getbucketlocation s3:getbucketlogging s3:listbucket s3:listbucketversions s3:listbucketmultipartuploads s3:getobjecttorrent s3:getobjectversionacl 

code follows:

awscredentials credentials = new basicawscredentials(accesskey, secretkey);     clientconfiguration clientconfig = new clientconfiguration();     clientconfig.setprotocol(protocol.http);     amazons3 conn = new amazons3client(credentials, clientconfig);     conn.setendpoint(bucketname);     bucket bucket = conn.createbucket(bucketname);     objectlisting objects = conn.listobjects(bucket.getname());     {             (s3objectsummary objectsummary : objects.getobjectsummaries()) {                     system.out.println(objectsummary.getkey() + "\t" +                             objectsummary.getsize() + "\t" +                             stringutils.fromdate(objectsummary.getlastmodified()));             }             objects = conn.listnextbatchofobjects(objects);     } while (objects.istruncated()); 

go iam , check whether user [ access key & secret key ] being used api has previliges use s3 based api.

attached s3 policy specified user - try s3 full access; can fine-grain access once works. more information check link [ managing iam policies ]


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -