Method: Aws::Transfer::Client#import_certificate

Defined in:
lib/aws-sdk-transfer/client.rb

#import_certificate(params = {}) ⇒ Types::ImportCertificateResponse

Imports the signing and encryption certificates that you need to create local (AS2) profiles and partner profiles.

You can import both the certificate and its chain in the Certificate parameter.

After importing a certificate, Transfer Family automatically creates a Amazon CloudWatch metric called DaysUntilExpiry that tracks the number of days until the certificate expires. The metric is based on the InactiveDate parameter and is published daily in the AWS/Transfer namespace.

It can take up to a full day after importing a certificate for Transfer Family to emit the DaysUntilExpiry metric to your account.

<note markdown=“1”> If you use the Certificate parameter to upload both the certificate and its chain, don’t use the CertificateChain parameter.

</note>

**CloudWatch monitoring**

The DaysUntilExpiry metric includes the following specifications:

  • Units: Count (days)

  • Dimensions: CertificateId (always present), Description (if provided during certificate import)

  • Statistics: Minimum, Maximum, Average

  • Frequency: Published daily

Examples:

Request syntax with placeholder values


resp = client.import_certificate({
  usage: "SIGNING", # required, accepts SIGNING, ENCRYPTION, TLS
  certificate: "CertificateBodyType", # required
  certificate_chain: "CertificateChainType",
  private_key: "PrivateKeyType",
  active_date: Time.now,
  inactive_date: Time.now,
  description: "Description",
  tags: [
    {
      key: "TagKey", # required
      value: "TagValue", # required
    },
  ],
})

Response structure


resp.certificate_id #=> String

Options Hash (params):

  • :usage (required, String)

    Specifies how this certificate is used. It can be used in the following ways:

    • SIGNING: For signing AS2 messages

    • ENCRYPTION: For encrypting AS2 messages

    • TLS: For securing AS2 communications sent over HTTPS

  • :certificate (required, String)
    • For the CLI, provide a file path for a certificate in URI format. For example, ‘–certificate file://encryption-cert.pem`. Alternatively, you can provide the raw content.

    • For the SDK, specify the raw content of a certificate file. For example, “ –certificate “‘cat encryption-cert.pem`” “.

    <note markdown=“1”> You can provide both the certificate and its chain in this parameter, without needing to use the CertificateChain parameter. If you use this parameter for both the certificate and its chain, do not use the CertificateChain parameter.

    </note>
    
  • :certificate_chain (String)

    An optional list of certificates that make up the chain for the certificate that’s being imported.

  • :private_key (String)
    • For the CLI, provide a file path for a private key in URI format. For example, ‘–private-key file://encryption-key.pem`. Alternatively, you can provide the raw content of the private key file.

    • For the SDK, specify the raw content of a private key file. For example, “ –private-key “‘cat encryption-key.pem`” “

  • :active_date (Time, DateTime, Date, Integer, String)

    An optional date that specifies when the certificate becomes active. If you do not specify a value, ActiveDate takes the same value as NotBeforeDate, which is specified by the CA.

  • :inactive_date (Time, DateTime, Date, Integer, String)

    An optional date that specifies when the certificate becomes inactive. If you do not specify a value, InactiveDate takes the same value as NotAfterDate, which is specified by the CA.

  • :description (String)

    A short description that helps identify the certificate.

  • :tags (Array<Types::Tag>)

    Key-value pairs that can be used to group and search for certificates.

See Also:



3097
3098
3099
3100
# File 'lib/aws-sdk-transfer/client.rb', line 3097

def import_certificate(params = {}, options = {})
  req = build_request(:import_certificate, params)
  req.send_request(options)
end