Can't pass my credentials to AWS PHP SDK

前端 未结 3 1779
梦如初夏
梦如初夏 2021-01-07 06:55

I installed AWS PHP SDK and am trying to use SES. My problem is that it\'s (apparently) trying to read ~/.aws/credentials no matter what I do. I currently have

3条回答
  •  攒了一身酷
    2021-01-07 07:25

    This solution will probably only work if you're using version 3 of the SDK. I use something similar to this:

    $provider = CredentialsProvider::memoize(CredentialsProvider::ini($profile, $path));
    $client = new SesClient([
        'version' => 'latest',
        'region'  => 'us-east-1',
        'credentials' => $provider]);
    

    I use this for S3Client, DynamoDbClient, and a few other clients, so I am assuming that the SesClient constructor supports the same arguments.

提交回复
热议问题