Skip to content

export_certificate

export_certificate(
    certificate_arn: Arn,
    passphrase: PassphraseBlob,
    *,
    config_overrides: Optional[ACMClientConfig] = None,
) -> ExportCertificateResponse

Exports a private certificate issued by a private certificate authority (CA) or a public certificate for use anywhere. The exported file contains the certificate, the certificate chain, and the encrypted private key associated with the public key that is embedded in the certificate. For security, you must assign a passphrase for the private key when exporting it.

For information about exporting and formatting a certificate using the ACM console or CLI, see Export a private certificate and Export a public certificate.

ACM public certificates created prior to June 17, 2025 cannot be exported.

Parameters:

  • certificate_arn (Arn) –

    An Amazon Resource Name (ARN) of the issued certificate. This must be of the form:

    arn:aws:acm:region:account:certificate/12345678-1234-1234-1234-123456789012

  • passphrase (PassphraseBlob) –

    Passphrase to associate with the encrypted exported private key.

    When creating your passphrase, you can use any ASCII character except #, $, or %.

    If you want to later decrypt the private key, you must have the passphrase. You can use the following OpenSSL command to decrypt a private key. After entering the command, you are prompted for the passphrase.

    openssl rsa -in encrypted_key.pem -out decrypted_key.pem

Raises:

  • InvalidArnException –

    The requested Amazon Resource Name (ARN) does not refer to an existing resource.

  • RequestInProgressException –

    The certificate request is in process and the certificate in your account has not yet been issued.

  • ResourceNotFoundException –

    The specified certificate cannot be found in the caller's account or the caller's account cannot be found.

  • ThrottlingException –

    The request was denied because it exceeded a quota.

  • ValidationException –

    The supplied input failed to satisfy constraints of an Amazon Web Services service.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_acm/_services/acm.py
def export_certificate(
    self,
    certificate_arn: "capo_acm.types.arn.Arn",
    passphrase: "capo_acm.types.passphrase_blob.PassphraseBlob",
    *,
    config_overrides: Optional[ACMClientConfig] = None,
) -> "capo_acm.types.export_certificate_response.ExportCertificateResponse":
    """<p>Exports a private certificate issued by a private certificate authority (CA) or a public certificate for use anywhere. The exported file contains the certificate, the certificate chain, and the encrypted private key associated with the public key that is embedded in the certificate. For security, you must assign a passphrase for the private key when exporting it. </p> <p>For information about exporting and formatting a certificate using the ACM console or CLI, see <a href="https://docs.aws.amazon.com/acm/latest/userguide/export-private.html">Export a private certificate</a> and <a href="https://docs.aws.amazon.com/acm/latest/userguide/export-public-certificate">Export a public certificate</a>.</p> <note> <p>ACM public certificates created prior to June 17, 2025 cannot be exported.</p> </note>

    Args:
        certificate_arn: <p>An Amazon Resource Name (ARN) of the issued certificate. This must be of the form:</p> <p> <code>arn:aws:acm:region:account:certificate/12345678-1234-1234-1234-123456789012</code> </p>
        passphrase: <p>Passphrase to associate with the encrypted exported private key. </p> <note> <p>When creating your passphrase, you can use any ASCII character except #, $, or %.</p> </note> <p>If you want to later decrypt the private key, you must have the passphrase. You can use the following OpenSSL command to decrypt a private key. After entering the command, you are prompted for the passphrase.</p> <p> <code>openssl rsa -in encrypted_key.pem -out decrypted_key.pem</code> </p>

    Raises:
        capo_acm.errors.invalid_arn_exception.InvalidArnException: <p>The requested Amazon Resource Name (ARN) does not refer to an existing resource.</p>
        capo_acm.errors.request_in_progress_exception.RequestInProgressException: <p>The certificate request is in process and the certificate in your account has not yet been issued.</p>
        capo_acm.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified certificate cannot be found in the caller's account or the caller's account cannot be found.</p>
        capo_acm.errors.throttling_exception.ThrottlingException: <p>The request was denied because it exceeded a quota.</p>
        capo_acm.errors.validation_exception.ValidationException: <p>The supplied input failed to satisfy constraints of an Amazon Web Services service.</p>
        capo_acm.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_acm.types.export_certificate_request.ExportCertificateRequest]",
    ) -> OperationResponse[
        "capo_acm.types.export_certificate_response.ExportCertificateResponse"
    ]:
        import capo_acm._operations.certificate_manager.export_certificate

        output, http_response = (
            capo_acm._operations.certificate_manager.export_certificate.export_certificate(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_acm.types.export_certificate_request.ExportCertificateRequest",
    ) -> dict[str, Any]:
        import capo_acm.types.export_certificate_request

        return capo_acm.types.export_certificate_request.redact_sensitive(input_)

    def _redact_output(
        output: "capo_acm.types.export_certificate_response.ExportCertificateResponse",
    ) -> dict[str, Any]:
        import capo_acm.types.export_certificate_response

        return capo_acm.types.export_certificate_response.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "ExportCertificate",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_acm.types.export_certificate_request.ExportCertificateRequest = {
        "certificate_arn": certificate_arn,
        "passphrase": passphrase,
    }

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output