本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
Amazon Private CA 使用示例 Amazon CLI
以下代码示例向您展示了如何使用with来执行操作和实现常见场景 Amazon Private CA。 Amazon Command Line Interface
操作是大型程序的代码摘录,必须在上下文中运行。您可以通过操作了解如何调用单个服务函数,还可以通过函数相关场景和跨服务示例的上下文查看操作。
场景是展示如何通过在同一服务中调用多个函数来完成特定任务任务的代码示例。
每个示例都包含一个指向的链接 GitHub,您可以在其中找到有关如何在上下文中设置和运行代码的说明。
主题
操作
以下代码示例演示如何使用 create-certificate-authority-audit-report
。
- Amazon CLI
-
创建证书颁发机构审计报告
以下
create-certificate-authority-audit-report
命令为由 ARN 标识的私有 CA 创建审计报告。aws acm-pca create-certificate-authority-audit-report --certificate-authority-arn arn:aws:acm-pca:us-east-1:accountid:certificate-authority/12345678-1234-1234-1234-123456789012 --s3-bucket-name your-bucket-name --audit-report-response-format JSON
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考CreateCertificateAuthorityAuditReport
中的。
-
以下代码示例演示如何使用 create-certificate-authority
。
- Amazon CLI
-
创建私有证书颁发机构
以下
create-certificate-authority
命令在您的 Amazon 账户中创建私有证书颁发机构。aws acm-pca create-certificate-authority --certificate-authority-configuration file://C:\ca_config.txt --revocation-configuration file://C:\revoke_config.txt --certificate-authority-type "SUBORDINATE" --idempotency-token 98256344
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考CreateCertificateAuthority
中的。
-
以下代码示例演示如何使用 delete-certificate-authority
。
- Amazon CLI
-
删除私有证书颁发机构
以下
delete-certificate-authority
命令删除由 ARN 标识的证书颁发机构。aws acm-pca delete-certificate-authority --certificate-authority-arn arn:aws:acm-pca:us-west-2:123456789012:certificate-authority/12345678-1234-1234-1234-123456789012
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考DeleteCertificateAuthority
中的。
-
以下代码示例演示如何使用 describe-certificate-authority-audit-report
。
- Amazon CLI
-
描述证书颁发机构的审计报告
以下
describe-certificate-authority-audit-report
命令列出了有关由 ARN 标识的 CA 的指定审计报告的信息。aws acm-pca describe-certificate-authority-audit-report --certificate-authority-arn arn:aws:acm-pca:us-west-2:123456789012:certificate-authority/99999999-8888-7777-6666-555555555555 --audit-report-id 11111111-2222-3333-4444-555555555555
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考DescribeCertificateAuthorityAuditReport
中的。
-
以下代码示例演示如何使用 describe-certificate-authority
。
- Amazon CLI
-
描述私有证书颁发机构
以下
describe-certificate-authority
命令列出了由 ARN 标识的私有 CA 的相关信息。aws acm-pca describe-certificate-authority --certificate-authority-arn arn:aws:acm-pca:us-west-2:123456789012:certificate-authority/12345678-1234-1234-1234-123456789012
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考DescribeCertificateAuthority
中的。
-
以下代码示例演示如何使用 get-certificate-authority-certificate
。
- Amazon CLI
-
检索证书颁发机构 (CA) 证书
以下
get-certificate-authority-certificate
命令检索 ARN 指定的私有 CA 的证书和证书链。aws acm-pca get-certificate-authority-certificate --certificate-authority-arn arn:aws:acm-pca:us-west-2:123456789012:certificate-authority/12345678-1234-1234-1234-123456789012 --output text
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考GetCertificateAuthorityCertificate
中的。
-
以下代码示例演示如何使用 get-certificate-authority-csr
。
- Amazon CLI
-
检索证书颁发机构的证书签名请求
以下
get-certificate-authority-csr
命令检索 ARN 指定的私有 CA 的 CSR。aws acm-pca get-certificate-authority-csr --certificate-authority-arn arn:aws:acm-pca:us-west-2:123456789012:certificate-authority/12345678-1234-1234-1234-123456789012 --output text
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考GetCertificateAuthorityCsr
中的。
-
以下代码示例演示如何使用 get-certificate
。
- Amazon CLI
-
检索已颁发的证书
以下
get-certificate
示例从指定的私有 CA 检索证书。aws acm-pca get-certificate \ --certificate-authority-arn arn:aws:acm-pca:us-west-2:123456789012:certificate-authority/12345678-1234-1234-1234-123456789012 \ --certificate-arn arn:aws:acm-pca:us-west-2:123456789012:certificate-authority/12345678-1234-1234-1234-123456789012/certificate/6707447683a9b7f4055627ffd55cebcc \ --output text
输出:
-----BEGIN CERTIFICATE----- MIIEDzCCAvegAwIBAgIRAJuJ8f6ZVYL7gG/rS3qvrZMwDQYJKoZIhvcNAQELBQAw cTELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xEDAOBgNVBAcMB1Nl ....certificate body truncated for brevity.... tKCSglgZZrd4FdLw1EkGm+UVXnodwMtJEQyy3oTfZjURPIyyaqskTu/KSS7YDjK0 KQNy73D6LtmdOEbAyq10XiDxqY41lvKHJ1eZrPaBmYNABxU= -----END CERTIFICATE---- -----BEGIN CERTIFICATE----- MIIDrzCCApegAwIBAgIRAOskdzLvcj1eShkoyEE693AwDQYJKoZIhvcNAQELBQAw cTELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xEDAOBgNVBAcMB1Nl ...certificate body truncated for brevity.... kdRGB6P2hpxstDOUIwAoCbhoaWwfA4ybJznf+jOQhAziNlRdKQRR8nODWpKt7H9w dJ5nxsTk/fniJz86Ddtp6n8s82wYdkN3cVffeK72A9aTCOU= -----END CERTIFICATE-----
输出的第一部分是证书本身。第二部分是链接到根 CA 证书的证书链。请注意,使用该
--output text
选项时,会在两个证书片段之间插入一个TAB
字符(这是缩进文本的原因)。如果您打算使用此输出并使用其他工具解析证书,则可能需要删除该TAB
字符,以便正确处理该字符。-
有关 API 的详细信息,请参阅Amazon CLI 命令参考GetCertificate
中的。
-
以下代码示例演示如何使用 import-certificate-authority-certificate
。
- Amazon CLI
-
将您的证书颁发机构证书导入 ACM PCA
以下
import-certificate-authority-certificate
命令将 ARN 指定的 CA 的已签名私有 CA 证书导入 ACM PCA。aws acm-pca import-certificate-authority-certificate --certificate-authority-arn arn:aws:acm-pca:us-west-2:123456789012:certificate-authority/12345678-1234-1234-1234-123456789012 --certificate file://C:\ca_cert.pem --certificate-chain file://C:\ca_cert_chain.pem
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考ImportCertificateAuthorityCertificate
中的。
-
以下代码示例演示如何使用 issue-certificate
。
- Amazon CLI
-
颁发私有证书
以下
issue-certificate
命令使用 ARN 指定的私有 CA 来颁发私有证书。aws acm-pca issue-certificate --certificate-authority-arn arn:aws:acm-pca:us-west-2:123456789012:certificate-authority/12345678-1234-1234-1234-123456789012 --csr file://C:\cert_1.csr --signing-algorithm "SHA256WITHRSA" --validity Value=365,Type="DAYS" --idempotency-token 1234
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考IssueCertificate
中的。
-
以下代码示例演示如何使用 list-certificate-authorities
。
- Amazon CLI
-
列出您的私有证书颁发机构
以下
list-certificate-authorities
命令列出了有关您账户中所有私有 CA 的信息。aws acm-pca list-certificate-authorities --max-results 10
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考ListCertificateAuthorities
中的。
-
以下代码示例演示如何使用 list-tags
。
- Amazon CLI
-
列出您的证书颁发机构的标签
以下
list-tags
命令列出了与 ARN 指定的私有 CA 关联的标签。aws acm-pca list-tags --certificate-authority-arn arn:aws:acm-pca:us-west-2:123456789012:certificate-authority/123455678-1234-1234-1234-123456789012 --max-results 10
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考ListTags
中的。
-
以下代码示例演示如何使用 revoke-certificate
。
- Amazon CLI
-
吊销私有证书
以下
revoke-certificate
命令吊销由 ARN 标识的 CA 的私有证书。aws acm-pca revoke-certificate --certificate-authority-arn arn:aws:acm-pca:us-west-2:1234567890:certificate-authority/12345678-1234-1234-1234-123456789012 --certificate-serial 67:07:44:76:83:a9:b7:f4:05:56:27:ff:d5:5c:eb:cc --revocation-reason "KEY_COMPROMISE"
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考RevokeCertificate
中的。
-
以下代码示例演示如何使用 tag-certificate-authority
。
- Amazon CLI
-
将标签附加到私有证书颁发机构
以下
tag-certificate-authority
命令将一个或多个标签附加到您的私有 CA。aws acm-pca tag-certificate-authority --certificate-authority-arn arn:aws:acm-pca:us-west-2:123456789012:certificate-authority/12345678-1234-1234-1234-123456789012 --tags Key=Admin,Value=Alice
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考TagCertificateAuthority
中的。
-
以下代码示例演示如何使用 untag-certificate-authority
。
- Amazon CLI
-
从您的私有证书颁发机构删除一个或多个标签
以下
untag-certificate-authority
命令从由 ARN 标识的私有 CA 中删除标签。aws acm-pca untag-certificate-authority --certificate-authority-arn arn:aws:acm-pca:us-west-2:123456789012:certificate-authority/12345678-1234-1234-1234-123456789012 --tags Key=Purpose,Value=Website
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考UntagCertificateAuthority
中的。
-
以下代码示例演示如何使用 update-certificate-authority
。
- Amazon CLI
-
更新您的私有证书颁发机构的配置
以下
update-certificate-authority
命令更新由 ARN 标识的私有 CA 的状态和配置。aws acm-pca update-certificate-authority --certificate-authority-arn arn:aws:acm-pca:us-west-2:123456789012:certificate-authority/12345678-1234-1234-1234-1232456789012 --revocation-configuration file://C:\revoke_config.txt --status "DISABLED"
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考UpdateCertificateAuthority
中的。
-