Hope someone could help out. I am new to the AWS SDK, and we have bucket, with sub buckets. I have the correct Access Key and Secret, since I can log in with CyberDuck and modify/delete files in the bucket, but when I try to list out the bucket contents I get a AccessDenied / 403 error code.
Here is the code that I am currently working with, that seems very straight forward. I just don't know if there's something else I need to do in my account (other permisisons) that are preventing me to list out the bucket contents. One thing to note is, if I do $client->ListBuckets(), I can see all my buckets available, but it's just the iterator portion that is getting held up.
require 'vendor/autoload.php';
use Aws\Common\Aws;
use Aws\Common\Iterator\AwsResourceIterator;
$aws = Aws::factory(array(
'key' => '###my_key###',
'secret' => '###my_secret###'
));
$client = $aws->get('s3');
$iterator = $client->getIterator('ListObjects', array('Bucket' => $bucket));
foreach ($iterator as $object) {
echo $object['Key'] . "\n";
}
And this is the error I am getting:
Fatal error: Uncaught Aws\S3\Exception\AccessDeniedException: AWS Error Code: AccessDenied, Status Code: 403, AWS Request ID: 195F81351F864AE4, AWS Error Type: client, AWS Error Message: Access Denied, User-Agent: aws-sdk-php2/2.8.30 Guzzle/3.9.3 curl/7.38.0 PHP/5.6.16 ITR thrown in /Volumes/localdev/www/aws/vendor/aws/aws-sdk-php/src/Aws/Common/Exception/NamespaceExceptionFactory.php on line 91
Any help would be greatly appreciated!