选择您的 Cookie 首选项

我们使用必要 Cookie 和类似工具提供我们的网站和服务。我们使用性能 Cookie 收集匿名统计数据,以便我们可以了解客户如何使用我们的网站并进行改进。必要 Cookie 无法停用,但您可以单击“自定义”或“拒绝”来拒绝性能 Cookie。

如果您同意,AWS 和经批准的第三方还将使用 Cookie 提供有用的网站功能、记住您的首选项并显示相关内容,包括相关广告。要接受或拒绝所有非必要 Cookie,请单击“接受”或“拒绝”。要做出更详细的选择,请单击“自定义”。

请求证书

聚焦模式
请求证书 - AWS Certification

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

以下示例演示了如何使用 RequestCertificate 函数。

package com.amazonaws.samples; import com.amazonaws.services.certificatemanager.AWSCertificateManagerClientBuilder; import com.amazonaws.services.certificatemanager.AWSCertificateManager; import com.amazonaws.services.certificatemanager.model.RequestCertificateRequest; import com.amazonaws.services.certificatemanager.model.RequestCertificateResult; import com.amazonaws.services.certificatemanager.model.InvalidDomainValidationOptionsException; import com.amazonaws.services.certificatemanager.model.LimitExceededException; import com.amazonaws.AmazonClientException; import com.amazonaws.auth.profile.ProfileCredentialsProvider; import com.amazonaws.auth.AWSStaticCredentialsProvider; import com.amazonaws.auth.AWSCredentials; import com.amazonaws.regions.Regions; import java.util.ArrayList; /** * This sample demonstrates how to use the RequestCertificate function in the AWS Certificate * Manager service. * * Input parameters: * DomainName - FQDN of your site. * DomainValidationOptions - Domain name for email validation. * IdempotencyToken - Distinguishes between calls to RequestCertificate. * SubjectAlternativeNames - Additional FQDNs for the subject alternative names extension. * * Output parameter: * Certificate ARN - The Amazon Resource Name (ARN) of the certificate you requested. * */ public class AWSCertificateManagerExample { public static void main(String[] args) { // Retrieve your credentials from the C:\Users\name\.aws\credentials file in Windows // or the ~/.aws/credentials file in Linux. AWSCredentials credentials = null; try { credentials = new ProfileCredentialsProvider().getCredentials(); } catch (Exception ex) { throw new AmazonClientException("Cannot load your credentials from file.", ex); } // Create a client. AWSCertificateManager client = AWSCertificateManagerClientBuilder.standard() .withRegion(Regions.US_EAST_1) .withCredentials(new AWSStaticCredentialsProvider(credentials)) .build(); // Specify a SAN. ArrayList<String> san = new ArrayList<String>(); san.add("www.example.com"); // Create a request object and set the input parameters. RequestCertificateRequest req = new RequestCertificateRequest(); req.setDomainName("example.com"); req.setIdempotencyToken("1Aq25pTy"); req.setSubjectAlternativeNames(san); // Create a result object and display the certificate ARN. RequestCertificateResult result = null; try { result = client.requestCertificate(req); } catch(InvalidDomainValidationOptionsException ex) { throw ex; } catch(LimitExceededException ex) { throw ex; } // Display the ARN. System.out.println(result); } }

前面的示例将创建类似于以下内容的输出。

{CertificateArn: arn:aws:acm:region:account:certificate/12345678-1234-1234-1234-123456789012}
隐私网站条款Cookie 首选项
© 2025, Amazon Web Services, Inc. 或其附属公司。保留所有权利。