AWS ACM Certificate Import

Here’s how to import a SSL certificate into AWS Certificate Manager.

aws acm import-certificate \
--certificate file://example.crt \
--private-key file://example.key \
--certificate-chain file://example-bundle.crt

AWS CLI List ACM Certificates

If you’ve imported or created a SSL certificate via AWS Certificate Manager, here’s the CLI to display a list of certificates.

aws acm list-certificates

Once you have the arn, you can describe certificate. Get the arn from the output above.

aws acm describe-certificate --certificate-arn arn-xxxxxxxxxxxxxxxxxx

Convert PFX to PEM format

SSL certificates comes in multiple formats. Some providers will hand you over certificates in PFX format which comes in a single file. If you need to import it to AWS Certificate Manager, you will need to convert it from PFX to PEM format. The following set of commands uses OpenSSL and pkcs12 to convert a SSL certificate from PFX to PEM format.

openssl pkcs12 -in cert.pfx -nocerts -out key.pem
openssl rsa -in key.pem -out server.key
openssl pkcs12 -in cert.pfx -clcerts -nokeys -out cert.pem
openssl pkcs12 -in cert.pfx -nodes -nokeys -out chain.pem

It result in 3 files.

  • server.key is the private key
  • cert.pem is the certificate
  • cert.pem and chain.pem are the full chain.

Once you have them, you can the proceed to import it to ACM.

SSL Certificate Import

Certificate Management Import

My previous post lightly talked about about adding SSL certificates via the AWS Console. This post talks about adding your own SSL certificate to Certificate Manager via the AWS CLI. The CLI which makes it super simple to manage. It also allows for automation as well.

aws acm import-certificate \
--certificate file://Certificate.pem \
--certificate-chain file://CertificateChain.pem \
--private-key file://PrivateKey.pem

If successful, it will return ARN or Amazon Resource Name.

CloudFront SSL Certificates

If you have SSL on your website, you can import your own SSL certificates into CloudFront, which is a content delivery network service by AWS. You will need to work a few AWS services to get it working.

  • CloudFront – create a distribution
  • Route 53 – create a hosted zone and add a CNAME
  • Certificate Manager – import your SSL certificate

Finally, on the WordPress side, enable the use CloudFront in your SuperCache plugin.

Seems simple, but you’ll need some patience to get it working.

Look at your HTML source to see if your CDN is really working.