Why my SDK is looking for the credentials in the wrong place? #2670
-
I'm trying to use DynammoDB on Debian with PHP 8.2, and SDK is looking for credentials in /usr/sbin/.aws/credentials, not the home. I've checked, and the PHP user has a .aws/credentials in the right place. I can fix that using the following:
But I would like to know why and how to fix that without using putenv or another workaround. PS: I tried to set the credentials on the fly, but the DynammoDB SDK returns an error |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi @angeloghiotto, There are a large number of ways you can authenticate, and at a quick glance it looks like you're trying to use the process credential provider as part of our default chain. If you look at the linked code, it defaults to looking for the credentials file in Since you're on Debian, it should be able to find the Alternatively, you could specifically pass in a directory to look in as shown in the example modified from the docs below:
|
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
Hi @angeloghiotto,
The main documentation on our credentials can be found here:
https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/guide_credentials_provider.html
There are a large number of ways you can authenticate, and at a quick glance it looks like you're trying to use the process credential provider as part of our default chain. If you look at the linked code, it defaults to looking for the credentials file in
self::getHomeDir() . '/.aws/credentials'
, where the getHomeDir function where the home directory function looks for theHOME
variable if it exists, and otherwise looks forHOMEDRIVE
andHOMEPATH
.Since you're on Debian, it should be able to find the
HOME
variable and b…