Configure the AWS SDK for PHP Version 3
The AWS SDK for PHP consists of various features and components. Each of the following topics describe the components that are used in the SDK.
The AWS SDKs and Tools Reference Guide also contains settings, features, and other foundational concepts common among many of the AWS SDKs.
Topics
Shared config
and
credentials
files
The shared AWS config
and credentials
files are the most common way that you can specify authentication and
configuration for the AWS SDK for PHP. Use these files to store settings that your tools and
applications can use across the AWS SDKs and the AWS Command Line Interface.
The shared AWS 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 AWS SDKs and Tools Reference Guide.
For all settings that you can store in these files, see Configuration and authentication settings reference in the AWS 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
AWS 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' ]);