By using AWS re:Post, you agree to the Terms of Use

How to connect a Lightsail instance to AWS CloudFront?


Hi, I want to know if is possible how to connect an Amazon Lightsail Instance to CloudFront.

Regards, Juan Balbuena.

6 Answers

Yes, that's definitely possible :) There are two things to consider in particular when setting this up.

First of all, you need to point your domain to CloudFront. You will want to set up a CNAME record in your DNS zone, pointing to the address you get when creating the CloudFront distribution. The name of that record should be "" if that's the domain you want to enable CloudFront on. Making (without www) work as well could be a bit more tricky as you can't use a CNAME for technical reasons. Route 53 offers a way around this, but the DNS management in Lightsail is a simpler version of that service essentially. But you can always add an A record for, pointing to your server IP address. Then your server can redirect those requests (additional configuration needed).

Secondly, CloudFront needs to contact your server on some address. You could add a second record to your DNS zone. This time you call it "" (or anything really), make it an A record, and point it to the server IP address.

answered 5 years ago

Pleas forgive my cross post ( )

What am I doing wrong? When I access I am redirected to ( note the loss of SSL and the annoying name change which isn't using cloudfront ).

Here's my configuration.
I'm NOT using lightsail DNS, rather I'm using Route 53.
I'm using a static IP from lightsail, let's say
Route 53 has an A record for using an ALIAS to the cloudfront domain name:
Route 53 has an A record for pointing to the lightsail static IP
Cloudfront has an origin domain name of
Cloudfront Origin Protocol Policy is HTTP Only.
Cloudfront Alternate Domain Names is
Cloudfront SSL Certificate is the one issued by Route53 for *
Cloudfront Viewer Protocol Policy is Redirect HTTP to HTTPS.

Thanks for your time and expertise!

answered 4 years ago

Hi JuanBalbuena and thanks for choosing Lightsail!

Did the response from D. Svanlund answer your question? If not, can you give me some detail on what exactly you're trying to accomplish and what you mean by "connect" your Lightsail instance to CloudFront?

answered 4 years ago

Thanks for your response.

My question has not yet been answered.

Cloudfront is AWS's Content Distribution Network ( CDN ). Besides the traditional benefits of CDN I also want to use Cloudfront's ability to access AWS Certificate Manager SSL certificates. The problem I am having is when I access the CDN URL I am redirected to the lightsail instance. ( e.g. redirects to ). I'm expecting to use the SSL certificate configured in CloudFront and Certificate Manager and the CDN to deliver the content using SSL.

Thanks again for your time and expertise!

answered 4 years ago


I have the same basic question: How to setup AWS cloudfront with lightsail? (in my case on a subdomain specifically for WordPress)

My lightsail (WordPress) server does not show up in the "Origin Domain Name" dropdown list when creating a new distribution. So what should I do? This description: is not clear on that to me.

Using the servers fixed IP address as "Origin Domain Name" in cloudfront is not allowed. So I created a DNS record in Route 53 ( to point to the static IP of my lightsail server. And I added this DNS record as "Origin Domain Name" in cloudfront (also including a https certificate * And I selected the cloudfront distribution as A record, type alias, in Route 53. The cloudfront Alternate Domain Names (CNAMEs) is .

This solution does not work:

  1. The cloudfront distribution does resolve the lightsail server but over http, it does not use the certificate I attached... Should I use redirect http to https?

  2. Also, if I click 'login' it redirects to "" i.e. the DNS that I assigned for the purpose of orgin domain name to cloudfront. The WordPress "WP_SITEURL" and "WP_HOME" settings somehow automatically reflect the DNS

  3. And also, the DNS name resolves the lightsail server (which I don't want). How to avoid this?

So I also tried creating the as A record (DNS) in Route 53 pointing to the static IP of the WordPress lightsail server. But then I cannot create the same as alias A record...

So I am stuck... Please advice? Many thanks in advance! Wouter

PS: points to a cloudfront distribution with a certificate which points to a static site in a S3 buckets and works fine.

answered 4 years ago

I am having the same problem. I have a Lightsail instance set up in Canada Central. I have created a Distribution for the Instance. I have also verifild my registered domain names for use with Custom Domains (which I probably don't need to do as I don't care if the static content being served from Cloudfront reflects the domain of my website or not). When I go to Route 53 to create and "Alias to CloudFront Distribution" the only region available is 'US East (N. Virginia)" and I have "No resources found." in that region.

I am going nutz here. I have been working on this for days. Please help.

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions