摘要:接入API 遇到了AUTHPARMAS 失败的问题,后来采用了SDK的方式
1、第一个问题credentials 无法识别,采用了强制写目录的方式
2、第二个问题说CA认证失败,修改了php.ini中的配置文件解决了问题
3、认证失败,通过检查发现是ID和KEY改变了造成的
use Aws\Ec2\Ec2Client;
use Aws\Credentials\CredentialProvider;
public function aws_test()
{
vendor('aws.aws-autoloader');
$profile = 'default';
$path = 'D:\phpStudy\WWW\tongyi-login\integration\.aws\credentials';
$provider = CredentialProvider::ini($profile, $path);
$provider = CredentialProvider::memoize($provider);
$ec2Client = new Ec2Client([
'region' => 'us-west-2',
'version' => '2016-11-15',
'credentials' => $provider
]);
$result = $ec2Client->describeInstances();
dd($result);
}
[curl]
; A default value for the CURLOPT_CAINFO option. This is required to be an
; absolute path.
curl.cainfo="D:\phpStudy\WWW\tongyi-login\integration\crt\cacert.pem"
openssl.cafile="D:\phpStudy\WWW\tongyi-login\integration\crt\cacert.pem"