createBucket([ 'Bucket' => $bucketName, ]); return 'The bucket\'s location is: ' . $result['Location'] . '. ' . 'The bucket\'s effective URI is: ' . $result['@metadata']['effectiveUri']; } catch (AwsException $e) { return 'Error: ' . $e->getAwsErrorMessage(); } } function createTheBucket() { $s3Client = new S3Client([ 'profile' => 'default', 'region' => 'us-east-1', 'version' => '2006-03-01' ]); echo createBucket($s3Client, 'my-bucket'); } // Uncomment the following line to run this code in an AWS account. // createTheBucket(); // snippet-end:[s3.php.create_bucket.main] // snippet-end:[s3.php.create_bucket.complete]