Skip to content

Instantly share code, notes, and snippets.

@trshafer
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trshafer/45cbdac03a3a09225d2c to your computer and use it in GitHub Desktop.
Save trshafer/45cbdac03a3a09225d2c to your computer and use it in GitHub Desktop.
Upload ssl certificate to cloudfront

A successful ssl upload command to cloudfront using a ssl certificate signed by comodo.

This is the cloudfront documentation: http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/SecureConnections.html#CNAMEsAndHTTPS

Here's my successful command:

aws iam upload-server-certificate --server-certificate-name myServerCertificate --certificate-body file:///Users/..../from_comodo.pem --private-key file:///Users/.../server.key.pem --certificate-chain file:///Users/.../chain.pem --path=/cloudfront/production/

Replace /Users/.... with the path to those files. And yes keep the three three slashes in the beginning.

RESPONSE:

{
    "ServerCertificateMetadata": {
        "Path": "/cloudfront/production/",
        "Arn": "SOME_TEXT_HERE/myServerCertificate",
        "ServerCertificateId": "SOME_CERTIFICATE_ID",
        "ServerCertificateName": "myServerCertificate",
        "UploadDate": "2014-06-01T04:53:00.413Z"
    }
}
  1. I used heroku's documentation to create the key and csr file. https://devcenter.heroku.com/articles/ssl-endpoint
  2. Here's what I did: I put COMODORSADomainValidationSecureServerCA.crt first and COMODORSAAddTrustCA.crt second. I put this in a file I created called chain.pem That is the --certificate-chain option.
  3. I ran openssl x509 -in from_comodo.crt -out from_comodo.pem -outform PEM on the crt that comes back from comodo. That is the -certificate-body option.
  4. I put server.key in the --private-key option. I ran it through a PEM converter using openssl. But it generated the same file. So I think you can just append .pem to server.key or maybe just submit it as server.key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment