Menu
AWS Certificate Manager
User Guide (Version 1.0)

Describing a Certificate

The following example shows how to use the DescribeCertificate function.

Copy
package com.amazonaws.samples; import com.amazonaws.regions.Region; import com.amazonaws.regions.Regions; import com.amazonaws.services.certificatemanager.AWSCertificateManagerClient; import com.amazonaws.services.certificatemanager.AWSCertificateManager; import com.amazonaws.services.certificatemanager.model.DescribeCertificateRequest; import com.amazonaws.services.certificatemanager.model.DescribeCertificateResult; import com.amazonaws.auth.profile.ProfileCredentialsProvider; import com.amazonaws.auth.AWSCredentials; import com.amazonaws.AmazonClientException; /** * This sample demonstrates how to use the DescribeCertificate function in the * AWS Certificate Manager service. This function returns a list of the fields * contained in the certificate specified by its ARN. * * Input Parameters: * CertificateArn - String that contains the Amazon Resource Name (ARN) for * the certificate. */ public class AWSCertificateManagerSample { public static void main(String [] args) throws Exception { // Retrieve the user's access key ID and secret access key. AWSCredentials credentials = null; try { credentials = new ProfileCredentialsProvider().getCredentials(); } catch (Exception e) { throw new AmazonClientException( "Cannot load the credentials from the credential profiles file. " + "Please make sure that your credentials file is at the correct " + "location (~/.aws/credentials in Linux or C:\\Users\\your_user_name\\.aws" + "in Windows), and is in a valid format.", e); } // Create an AWSCertificateManager client and set the region. AWSCertificateManager acm = new AWSCertificateManagerClient(credentials); Region usEast1 = Region.getRegion(Regions.US_EAST_1); acm.setRegion(usEast1); // Specify the certificate ARN and call the describeCertificate() function. String certARN = "arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012"; DescribeCertificateRequest certRequest = new DescribeCertificateRequest().withCertificateArn(certARN); DescribeCertificateResult res = acm.describeCertificate(certRequest); System.out.println(res); } }