1

-solved-

I am very new to using AWS and this is definitely a novice question, but I've been stuck on this for sometime now and I haven't been able to find an answer.

I am running an EC2 instance with a IAM role that has the AmazonS3FullAccess policy attached. I am attempting to run the following PHP code:

<?php

echo '<br>loaded file<br>';

// SDK downloaded as ZIP file
require_once('SDK/aws-autoloader.php');
echo '<br>loaded sdk<br>';

use Aws\Exception\AwsException;
use Aws\S3\Exception\S3Exception;

// Use the us-east-1 region and latest version of each client.
$SharedConfig =
[
    'region'    => 'us-east-1',
    'version'   => 'latest'
];

// Create an SDK class used to share configuration across clients.
$SDK = new Aws\Sdk($SharedConfig);
echo '<br>created sdk object<br>';

// Create an Amazon clients using the shared configuration data.
$S3Client = $SDK->createS3();
echo '<br>created s3 client<br>';

$RDSClient = $SDK->createRds();
echo '<br>created rds client<br>';

$Buckets = $S3Client->listBuckets();
echo '<br>bucket list<br>';

var_dump($Buckets);
echo '<br>end of list<br>';

Accessing the page outputted the following:

loaded file

loaded sdk

created sdk object

created s3 client

created rds client

which implies nothing after "$Buckets = $S3Client->listBuckets();" was executed.

I would like to ask the following:

  1. What is the correct way to call listBuckets() using a PHP script ran by an EC2 instance configured through IAM roles?

  2. Assuming SDK functions generate error messages and/or exceptions, how do I view these error messages and/or exceptions?

Thanks in advance.

  • 1
    I would assume the error messages would be in the same place you would expect to find all your other PHP error messages. http://stackoverflow.com/questions/5127838/where-does-php-store-the-error-log-php5-apache-fastcgi-cpanel – Mark B Dec 24 '15 at 17:13
  • Thanks. I was able to find some error messages that indicated my php.ini was missing a few configuration settings not required by PHP but used by the SDK. – OverflowSomeStacks Dec 29 '15 at 17:42

0 Answers0