GetCertificatesCommand

Returns information about one or more Amazon Lightsail SSL/TLS certificates.

To get a summary of a certificate, omit includeCertificateDetails from your request. The response will include only the certificate Amazon Resource Name (ARN), certificate name, domain name, and tags.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { LightsailClient, GetCertificatesCommand } from "@aws-sdk/client-lightsail"; // ES Modules import
// const { LightsailClient, GetCertificatesCommand } = require("@aws-sdk/client-lightsail"); // CommonJS import
const client = new LightsailClient(config);
const input = { // GetCertificatesRequest
  certificateStatuses: [ // CertificateStatusList
    "PENDING_VALIDATION" || "ISSUED" || "INACTIVE" || "EXPIRED" || "VALIDATION_TIMED_OUT" || "REVOKED" || "FAILED",
  ],
  includeCertificateDetails: true || false,
  certificateName: "STRING_VALUE",
  pageToken: "STRING_VALUE",
};
const command = new GetCertificatesCommand(input);
const response = await client.send(command);
// { // GetCertificatesResult
//   certificates: [ // CertificateSummaryList
//     { // CertificateSummary
//       certificateArn: "STRING_VALUE",
//       certificateName: "STRING_VALUE",
//       domainName: "STRING_VALUE",
//       certificateDetail: { // Certificate
//         arn: "STRING_VALUE",
//         name: "STRING_VALUE",
//         domainName: "STRING_VALUE",
//         status: "PENDING_VALIDATION" || "ISSUED" || "INACTIVE" || "EXPIRED" || "VALIDATION_TIMED_OUT" || "REVOKED" || "FAILED",
//         serialNumber: "STRING_VALUE",
//         subjectAlternativeNames: [ // SubjectAlternativeNameList
//           "STRING_VALUE",
//         ],
//         domainValidationRecords: [ // DomainValidationRecordList
//           { // DomainValidationRecord
//             domainName: "STRING_VALUE",
//             resourceRecord: { // ResourceRecord
//               name: "STRING_VALUE",
//               type: "STRING_VALUE",
//               value: "STRING_VALUE",
//             },
//             dnsRecordCreationState: { // DnsRecordCreationState
//               code: "SUCCEEDED" || "STARTED" || "FAILED",
//               message: "STRING_VALUE",
//             },
//             validationStatus: "PENDING_VALIDATION" || "FAILED" || "SUCCESS",
//           },
//         ],
//         requestFailureReason: "STRING_VALUE",
//         inUseResourceCount: Number("int"),
//         keyAlgorithm: "STRING_VALUE",
//         createdAt: new Date("TIMESTAMP"),
//         issuedAt: new Date("TIMESTAMP"),
//         issuerCA: "STRING_VALUE",
//         notBefore: new Date("TIMESTAMP"),
//         notAfter: new Date("TIMESTAMP"),
//         eligibleToRenew: "STRING_VALUE",
//         renewalSummary: { // RenewalSummary
//           domainValidationRecords: [
//             {
//               domainName: "STRING_VALUE",
//               resourceRecord: {
//                 name: "STRING_VALUE",
//                 type: "STRING_VALUE",
//                 value: "STRING_VALUE",
//               },
//               dnsRecordCreationState: {
//                 code: "SUCCEEDED" || "STARTED" || "FAILED",
//                 message: "STRING_VALUE",
//               },
//               validationStatus: "PENDING_VALIDATION" || "FAILED" || "SUCCESS",
//             },
//           ],
//           renewalStatus: "PendingAutoRenewal" || "PendingValidation" || "Success" || "Failed",
//           renewalStatusReason: "STRING_VALUE",
//           updatedAt: new Date("TIMESTAMP"),
//         },
//         revokedAt: new Date("TIMESTAMP"),
//         revocationReason: "STRING_VALUE",
//         tags: [ // TagList
//           { // Tag
//             key: "STRING_VALUE",
//             value: "STRING_VALUE",
//           },
//         ],
//         supportCode: "STRING_VALUE",
//       },
//       tags: [
//         {
//           key: "STRING_VALUE",
//           value: "STRING_VALUE",
//         },
//       ],
//     },
//   ],
//   nextPageToken: "STRING_VALUE",
// };

GetCertificatesCommand Input

See GetCertificatesCommandInput for more details

Parameter
Type
Description
certificateName
string | undefined

The name for the certificate for which to return information.

When omitted, the response includes all of your certificates in the Amazon Web Services Region where the request is made.

certificateStatuses
CertificateStatus[] | undefined

The status of the certificates for which to return information.

For example, specify ISSUED to return only certificates with an ISSUED status.

When omitted, the response includes all of your certificates in the Amazon Web Services Region where the request is made, regardless of their current status.

includeCertificateDetails
boolean | undefined

Indicates whether to include detailed information about the certificates in the response.

When omitted, the response includes only the certificate names, Amazon Resource Names (ARNs), domain names, and tags.

pageToken
string | undefined

The token to advance to the next page of results from your request.

To get a page token, perform an initial GetCertificates request. If your results are paginated, the response will return a next page token that you can specify as the page token in a subsequent request.

GetCertificatesCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
certificates
CertificateSummary[] | undefined

An object that describes certificates.

nextPageToken
string | undefined

If NextPageToken is returned there are more results available. The value of NextPageToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged.

Throws

Name
Fault
Details
AccessDeniedException
client

Lightsail throws this exception when the user cannot be authenticated or uses invalid credentials to access a resource.

InvalidInputException
client

Lightsail throws this exception when user input does not conform to the validation rules of an input field.

Domain and distribution APIs are only available in the N. Virginia (us-east-1) Amazon Web Services Region. Please set your Amazon Web Services Region configuration to us-east-1 to create, view, or edit these resources.

NotFoundException
client

Lightsail throws this exception when it cannot find a resource.

ServiceException
server

A general service exception.

UnauthenticatedException
client

Lightsail throws this exception when the user has not been authenticated.

LightsailServiceException
Base exception class for all service exceptions from Lightsail service.