Amazon Web Services – A client error (MalformedCertificate) occurred when calling the UploadServerCertificate operation: Unable to parse certificate. Please ensure the certificate is in PEM format

While I am trying to upload ssl certificate with aws cli got error saying MalformedCertificate

I used following command to upload ssl certificate:

aws iam upload-server-certificate --server-certificate-name MysiteCertificate --certificate-body public.crt --private-key private.key --certificate-chain intermediate.pem

Output:
A client error (MalformedCertificate) occurred when calling the UploadServerCertificate operation: Unable to parse certificate. Please ensure the certificate is in PEM format.

After debugging for a while adding file:// before file name is solved issue & below is the command that worked for me:

aws iam upload-server-certificate --server-certificate-name MysiteCertificate --certificate-body file://home/guest/Downloads/mysite/public.crt --private-key file://home/guest/Downloads/mysite/private.key --certificate-chain file://home/guest/Downloads/mysite/intermediate.pem

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s