DEV Community

Nazareno Pesado
Nazareno Pesado

Posted on • Updated on

Use a custom domain and SSL on AWS Lightsail instance

In our agency we need to migrate a platform, which we have hosted in a GoDaddy VPS to a AWS Lightsail instance.

We started to love❤️ Lightsail because it's simplicity to up and run different system blueprints that makes our business run smooth.

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 learning process

Update domain zone

The first one is that we already have a domain name registered in GoDaddy and we need to point it to the need instance.

We opened domain panel in GoDaddy and updated the A record in our DNS Zone to point to the AWS Lightsail instance static public IP

That process takes a little while, so you can check the DNS propagation process with a tool like

After that we already have our domain pointed to our new instance but here is where it came the second issue.

Reissue the SSL certificate

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.

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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:

Enter fullscreen mode Exit fullscreen mode

After this step we need to update the server name in the apache2 httpd.conf file with the domain name

With this we have our new instance up and running with a domain and a SSL certificate.

Top comments (0)