1. From the Strattic dashboard click Domain Settings, input your domain (without the www), select checkbox, and click submit.
You'll see a CNAME like this to validate the SSL certificate for the root domain.
2. Log in to your AWS console and navigate to Route 53.
3. Create a new hosted zone for your domain or use an existing hosted zone.
4. Add the CNAME to validate SSL (within domain hosting zone).
5. Please wait up to 30 minutes for this verification process to complete.
6. Click “Next” in the Strattic Dashboard.
7. You’ll see a CNAME like this:
8. Add the record as an Alias A record to Cloudfront. Hint: just paste in the CloudFront value.
How to set up a redirect from www to root
(eg: www.example.com to example.com)
This will include:
Welcome to your little AWS crash course! Don’t worry, it isn't as scary as it looks 😉
Creating the s3 bucket
1. Navigate to s3 in your AWS console.
2. Create a new bucket with the name of your domain (eg: www.example.com) in region us-east-1. Make sure Block all public access is unchecked and click Save.
We’ll set up the redirect using the S3 static web hosting feature.
3. Navigate to the s3 bucket just created and select properties. Find the static web hosting section and Click on Edit.
4. Enable static web hosting, with type Redirects. The host name should be your root domain (eg: example.com), and the protocol should be set to https. Then hit Save Changes.
You can now test the redirection by clicking the link shown. Copy this link and save it somewhere, as we’re going to need it later on.
Creating the SSL Certificate for the www domain
1. Open up AWS Certificate Manager and click request a certificate (you can also import a custom certificate). Then select “Request a public certificate” and click “Request a Certificate”.
2. Enter your domain name including the www and click Next.
3. Select DNS Validation and click Next. On the next screen you can choose to add a tag, and then click Review. Once you review that everything is correct, click Confirm and Request.
4. Your new certificate will now have the status of Pending Validation. In order for the certificate to be issued, you will need to add the CNAME record provided to your hosting zone in Route 53.
After adding that CNAME it may take some time to propagate, but once the certificate status has updated to Issued, we can move on to creating the Cloudfront Distribution.
Create the Cloudfront distribution for the redirect
1. Open up Cloudfront in your AWS console and click on Create Distribution, then click Get started.
2. Under Origin Domain Name, you will need to add the domain for your static site that we saved earlier. The Origin ID will be populated automatically.
3. For Viewer protocol policy, select “Redirect HTTP to HTTPS”.
4. Add your domain name including the www under Alternate Domain Names.
5. For the SSL certificate, select “Custom SSL certificate", and choose the one that was just created for your domain from the dropdown.
6. All other settings can be left as the default, and you can go ahead and click on Create Distribution.
7. You can now add the final CNAME record in Route 53 for your www domain, which points to the new Cloudfront distribution domain. Your final Route 53 records should look something like this.
And that’s it! You’ll receive your AWS certificate in the post! 🙃