27

I'm doing:

aws iam upload-server-certificate --server-certificate-name MysiteCertificate --certificate-body Downloads/mysite/mysite.crt --private-key mysite.pem --certificate-chain Downloads/mysite/COMODOSSLCA.crt

I'm getting an error though: A client error (MalformedCertificate) occurred when calling the UploadServerCertificate operation: Unable to parse certificate. Please ensure the certificate is in PEM format.

It is a valid pem file though =(

5
  • Test that the uploaded cert is correct (linebreaks?): wget Downloads/mysite/mysite.crt -O webcert.crt and then openssl x509 -in webcert.crt -text -noout Mar 24, 2014 at 21:19
  • Yup, looks good.
    – Shamoon
    Mar 24, 2014 at 21:21
  • 3
    try adding file:// before the file names Mar 24, 2014 at 21:25
  • Make that an answer so I Can vote for it =)
    – Shamoon
    Mar 24, 2014 at 21:26
  • sure, glad I could help! Mar 24, 2014 at 21:37

2 Answers 2

53

Add a file:// before the file names.

3
  • 6
    This is what it was for me. What a terribly unhelpful error for the AWS CLI to throw! Feb 12, 2015 at 19:13
  • 3
    Seriously the least helpful error message I've seen in a while. Jun 26, 2015 at 18:21
  • Worked for me as well. Nov 18, 2015 at 13:31
8

I've seen this when the key wasn't in RSA format. If you check the header for your key and it is -----BEGIN PRIVATE KEY----- instead of -----BEGIN RSA PRIVATE KEY----- that's probably your problem. You can get the key into RSA with:

 openssl rsa -in my-private-key.pem > private-rsa-key.pem
2
  • this is the only place i could find this answer. thanks!
    – Nuriel
    Jun 14, 2015 at 8:56
  • I have it beginning with -----BEGIN RSA PRIVATE KEY-----, and its been outputted as a .pem and for sure RSA, but it still returns the same error. I generated the key with openssl genrsa -des3 -out server.pass.key 2048 and openssl rsa -in server.pass.key -out server.key
    – Trip
    Dec 21, 2015 at 20:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .