43
Use a custom domain and SSL on AWS Lightsail instance
In our agency bitopia.digital we need to migrate a platform, which we have hosted in a GoDaddy VPS to a AWS Lightsail instance.
We found two issues in the process, so i'm writing this to help any of you who maybe are trying to achieve this kind of stuff.
The first one is that we already have a domain name registered in GoDaddy and we need to point it to the need instance.
That process takes a little while, so you can check the DNS propagation process with a tool like https://dnschecker.org
After that we already have our domain pointed to our new instance but here is where it came the second issue.
This step could be tricky, but it's easy to follow along.
The first thing we need to do is to generate a a new private key for our AWS Lightsail instance.
The first thing we need to do is to generate a a new private key for our AWS Lightsail instance.
We logged in through SSH in our instance and we run the following command to generate a new private key:
sudo openssl genrsa -out /opt/bitnami/apache2/conf/bitnami/certs/server.key 2048
With that key we need to create a certificate to send to the Certificate Authority:
sudo openssl req -new -key /opt/bitnami/apache2/conf/bitnami/certs/server.key -out /opt/bitnami/apache2/conf/bitnami/certs/cert.csr
Send cert.csr to the certificate authority. When the certificate authority completes their checks, they will hand over your new certificate to you.
With the new certificate file (probably a *.crt file), we need to upload it to our instance with the following name:
/opt/bitnami/apache2/conf/bitnami/certs/server.crt
With this we have our new instance up and running with a domain and a SSL certificate.