In this step we setup a custom domain name to point at our Elastic Beanstalk environment and configure it to use SSL.
To create a custom domain pointing at our environment we need to create either a CNAME or an ALIAS that points to our environment URL. You can find the URL for your environment on the dashboard screen.
Copy this URL and go to your domain registrar admin site. Follow the instructions for your domain registrar for adding a CNAME record that points to your environment URL.
It may take some time depending on your registrar for the new entries to propagate but once they have propagated you can test by navigating to your new domain name. You should see the app that you have deployed to your environment.
We now need to setup SSL for our environment so we can use HTTPS. The best way to do this is to use the AWS Certificate Manager.
You can add both specific domain names to your certificate or wildcard domains. If you want to access your site using a bare name (e.g. cmgresearch.com) then you need to add that explicitly as a wildcard (*.cmgresearch.com) does not include it.
To validate the certificate Amazon will send an email to the contact email address associated with each domain you are requesting a certificate for. Once you have approved the certificate you can use it in Elastic Beanstalk.
Navigate to your Elastic Beanstalk environment and go to the configuration tab and then select the load balancer configuration. Enable the
Secure listener port and in the
SSL certificate ID dropdown pick your new certificate.
Once the configuration has finished updating check that you can access you site over HTTPS and that the certificate is valid.
If you followed all the previous steps you now have a Rails application that can be deployed by a CI server and is secured by HTTPS.