Configure the Amazon SDK for PHP Version 3 - 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).

Configure the Amazon SDK for PHP Version 3

The Amazon SDK for PHP consists of various features and components. Each of the following topics describe the components that are used in the SDK.

The Amazon SDKs and Tools Reference Guide also contains settings, features, and other foundational concepts common among many of the Amazon SDKs.

Shared config and credentials files

The shared Amazon config and credentials files are the most common way that you can specify authentication and configuration for the Amazon SDK for PHP. Use these files to store settings that your tools and applications can use across the Amazon SDKs and the Amazon Command Line Interface.

The shared Amazon config and credentials files are plaintext files that reside by default in a folder named .aws that is placed in the "home" folder on your computer. For details on the location of these files, see Location of the shared config and credentials files in the Amazon SDKs and Tools Reference Guide.

For all settings that you can store in these files, see Configuration and authentication settings reference in the Amazon SDKs and Tools Reference Guide. This reference also covers the precedence of applying settings from alternative sources such as environment variables.

Named profiles

Settings within the shared config and credentials files are associated with a specific profile. With multiple profiles, you can create different settings configurations to apply in different scenarios. One of the profiles is designated as the default profile and is used automatically when you don't explicitly specify a profile to use.

To learn more about setting up named profiles, see Shared config and credentials files in the Amazon SDKs and Tools Reference Guide.

You can specify a named profile to use when instantiating a client by using the profile option:

use Aws\DynamoDb\DynamoDbClient; // Instantiate a client with the credentials from the my_profile_name profile $client = new DynamoDbClient([ 'profile' => 'my_profile_name', 'region' => 'us-west-2', 'version' => 'latest' ]);