Configuring CloudFront to use ACM ( Amazon certificate manager) and redirect all the traffic to HTTPS

26Jan,16 Post Image

Amazon announced AWS Certificate Manager (ACM) last week. This means free SSL certs!
Thank you Amazon for solving this major pain in operation!

In this blog post we show how to setup ACM wildcard cert on Cloudfront Distribution.

1) Go to cloud front and click on select the CloudFront distribution and click edit on general

2) Select Custom SSL Certificate (example.com): and click on Request an ACM Certificate

ACM-1

3) Type the domain name you want,In this example we will get wildcard cert for *.nOps.io.

ACM-2

4) Click confirm and request. After you request the certificate, an email will be sent to the registered owner for
the domain.

ACM-3

That’s it! Once you get the email that you approved the cert, go back to edit under general. There will be an
option to select the newly generated cert.

Redirect everything to HTTPS.

If you want to redirect everything to HTTPS, select behavior under the distribution. Click on create behavior,
select “Redirect HTTP to HTTPS”

ACM-4

That’s it, now all the non-HTTPS traffic will get redirected to HTTPS.

Redirect all non-www traffic to https://www

Another challenge we found was to figure out how to redirect nOps.io to https://www.nOps.io, since, *.nOps.io
doesn’t cover nOps.io.

1) Go to route53 and point the root domain to s3 bucket. Record type A and select Alias
2) Go to the s3 bucket where the site is hosted
3) Click on properties for index.html.
4) Click on Add more metadata
5) Select key Website Redirect Location and in value put in the redirect url

ACM-5

That’s it. You are all set! Free cert, and all non-ssl traffic redirected to HTTPS. Life is good.

Subscribe to Our Newsletter

Join our community of DevOps enthusiast - Get free tips, advice, and insights from our industry leading team of AWS experts.