Credentials for the AWS SDK for PHP Version 3 (original) (raw)

For reference information on available credentials mechanisms for the AWS SDKs, seeCredentials and access in the_AWS SDKs and Tools Reference Guide_.

Important

For security, we strongly recommend that you do not use the root account for AWS access. Always refer to theSecurity best practices in IAM in the IAM User Guide for the latest security recommendations.

Precedence of settings

When you initialize a new service client without providing any credential arguments, the SDK uses the default credential provider chain to find AWS credentials. The SDK uses the first provider in the chain that returns credentials without an error.

The AWS SDK for PHP has a series of places that it checks in order to find values for global settings and credential providers. The following is the order of precedence:

  1. Any explicit setting set in the code or on a service client itself takes precedence over anything else.
  2. Use credentials from environment variables.
    Setting environment variables is useful if you’re doing development work on a machine other than an Amazon EC2 instance.
  3. Shared config and credentials files.
    These are the same files used by other SDKs and the AWS CLI.
Topics

Configuration options

Work with credential providers

Did this page help you? - Yes

Thanks for letting us know we're doing a good job!

If you've got a moment, please tell us what we did right so we can do more of it.

Did this page help you? - No

Thanks for letting us know this page needs work. We're sorry we let you down.

If you've got a moment, please tell us how we can make the documentation better.