I have 2 pem files - web.pem and api.pem. Converted from .pfx. Exported from EC2 servers - web server and api server. (don't ask me why.. its a legacy app) If I include 1 .pem file in Certificate body, it can be detected and is a valid PEM format.
But if include both .pem file as below
-----BEGIN CERTIFICATE-----
.... api
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
.... web
-----END CERTIFICATE-----
I got an error as below.
The certificate body provided is not in a valid PEM format.
How do I include both .pem file in Certificate body so it will return as valid PEM format?
Thank you.
You can't import two separate SSL certificates into a single ACM certificate like that. That's just not how SSL certificates work. A single SSL certificate can only contain one private key.
If you want a single AWS ACM SSL certificate to work with multiple domain names, then you need to create a new certificate with multiple domain names listed in the certificate. I suggest you do this by simply creating a new SSL certificate directly in ACM instead of trying to create the certificate outside of ACM and importing it.
If you absolutely have to use the SSL certificates you currently have, because of legacy reasons, then you will have to import them as two separate certificates in ACM, but then you won't be able to use them in the same AWS load balancer or CloudFront distribution.