AWS域名绑定前置步骤-申请ACM证书

<?php
namespace app\admin\controller;

use Aws\AwsClient;
use Aws\Acm\AcmClient;
use Aws\Credentials\CredentialProvider;

class AWSUtil{

    public function init(){

    
        
        $acmClient = new AcmClient([
            'region' => 'us-east-1',
            'version' => '2015-12-08',
            'credentials'=>[
                // 'id'=>"851725259723",
                'key'=>"AKIA4MTWICPFTJEVQ25E",
                "secret"=>"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"
            ]
            
        ]);
        
        
        $result = $acmClient->requestCertificate([
            'DomainName' => 'ddddddddddddddddddd.com',  
            'IdempotencyToken' => "1234",
            'Options' => [
                'CertificateTransparencyLoggingPreference' => 'DISABLED',
            ],
            'ValidationMethod' => 'DNS',
        ]);

        return  $result->get("CertificateArn");
    
    }

}

接口返回内容:

Model Data
----------
Data can be retrieved from the model object using the get() method of the
model (e.g., `$result->get($key)`) or "accessing the result like an
associative array (e.g. `$result['key']`). You can also execute JMESPath
expressions on the result data using the search() method.

{
    "CertificateArn": "arn:aws:acm:us-east-1:851725259723:certificate\/9fb07269-f4d2-43b2-97bd-a0d0caff1639",
    "@metadata": {
        "statusCode": 200,
        "effectiveUri": "https:\/\/acm.us-east-1.amazonaws.com",
        "headers": {
            "x-amzn-requestid": "cb49fac1-1933-4928-a6e0-bece59993b5a",
            "content-type": "application\/x-amz-json-1.1",
            "content-length": "104",
            "date": "Tue, 12 Nov 2024 08:11:28 GMT",
            "connection": "close"
        },
        "transferStats": {
            "http": [
                []
            ]
        }
    }
}

后台看到了我们用代码申请的证书:

拿着这个domain地址ddddddddddddd.com 和返回的证书内容CertificateArn去到域名后台配置映射。如下图第一步:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值