AuthUsingAcctOrUserCredPHP3
Making Requests Using AWS Account or IAM User Credentials - AWS SDK for PHP
This section explains how to use a class from version 3 of the AWS SDK for PHP to send authenticated requests using your AWS account or IAM user credentials. It assumes that you are already following the instructions for Using the AWS SDK for PHP and Running PHP Examples and have the AWS SDK for PHP properly installed.
The following PHP example shows how the client makes a request using your security credentials to list all of the buckets for your account.
Example
Note
You can create the S3Client
client without providing your security credentials. Requests sent using this client are anonymous requests, without a signature. Amazon S3 returns an error if you send anonymous requests for a resource that is not publicly available.
For working examples, see Operations on Objects. You can test these examples using your AWS account or IAM user credentials.
For an example of listing object keys in a bucket, see Listing Keys Using the AWS SDK for PHP.