Create anonymous clients - Amazon SDK for PHP
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Create anonymous clients

In some cases, you might want to create a client that is not associated with any credentials. This enables you to make anonymous requests to a service.

For example, you can configure both Amazon S3 objects and Amazon CloudSearch domains to allow anonymous access.

To create an anonymous client, you set the 'credentials' option to false.

$s3Client = new S3Client([ 'version' => 'latest', 'region' => 'us-west-2', 'credentials' => false ]); // Makes an anonymous request. The object would need to be publicly // readable for this to succeed. $result = $s3Client->getObject([ 'Bucket' => 'my-bucket', 'Key' => 'my-key', ]);