Ssl – AWS EC2 SSL Server certificate does not match the URL

amazon ec2amazon-web-servicessslssl-certificate

After uploading the certificate to iam, when I visit https://www.mywebsite.com I get this error

The identity of this website has not been verified.
  • Server's certificate does not match the URL.
  • Server's certificate is not trusted.

And if I click on certificate information, everything is wrong

www.example.com
Self-signed root certificate
Expires: Friday 27 September 2024 ........

If I query the certificate I've uploaded

aws iam get-server-certificate --server-certificate-name certificate_mycertificate

I get this

"ServerCertificateMetadata": {
        "ServerCertificateId": "XXX", 
        "ServerCertificateName": "certificate_mycertificate", 
        "Expiration": "2015-11-21T23:59:59Z", 
        "Path": "/", 
        "Arn": "arn:aws:iam::XXX:server-certificate/certificate_mycertificate", 
        "UploadDate": "2014-11-21T14:56:13Z"
}

Something is wrong, it's my first experience with SSL and I don't have too much experience with aws, any help will be much appreciated, at least where I have to start looking to solve this problem.

Additional details:

I've set up a virtual host in my local machine that points to the ip of our ec2, with the domain that is in the certificate, that's where I get the wrong certificate information.

In our ec2 there are no load balancer set up, the only thing I did is to generate a certificate, I sent it to the CA, activated the certificate and uploaded the certificate that I get back from the CA (the chain too).
We have 4 instances in our ec2.
Do I need to create a load balancer?

We developed a magento website that is one of the instances in our ec2, we don't have access to the domain because the old website is still live in another server not "owned" by us, we are in the end of the development and we have to set up everything for the actual go-live, so our magento website has as a domain something like ec2-23-23-12-45….. that's why I set up a virtual host on my local machine to check if ssl was working (my boss told me to do this step to verify the ssl)

It looks like is not a problem with the certificate, but a problem of config with ec2, or something different.

I get the same result with an SSL Certificate Checker:

SSL certificate

Common Name = www.example.com
Issuer = www.example.com
Serial Number = A209D18396BD4A44
SHA1 Thumbprint = 307D5DC2E2BBEAB3674558DCFE781DE8896965DF
Key Length = 1024 bit
Signature algorithm = SHA1 + RSA (good)
Secure Renegotiation: Supported

SSL Certificate expiration

The certificate expires September 27, 2024 (3597 days from today)

Thanks

Best Answer

Your EC2 instance is running a web-server, so, what you need is to install the certificate in that web-server. Upload a certificate to IAM only makes sense when you use CloudFront, ELB, etc. and you want this services under HTTPS.

One application of using certificates is to allow HTTPS access for Elastic Load Balancing. Actually, the server certificates can be used with CloudFront and AWS OpsWorks as well.

Amazon AWS – Understanding IAM Server Certificates