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 xyz.cloudfront.net address you get when creating the CloudFront distribution. The name of that record should be "www.example.com" if that's the domain you want to enable CloudFront on. Making example.com (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 example.com, 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 "origin.example.com" (or anything really), make it an A record, and point it to the server IP address.
Pleas forgive my cross post ( https://forums.aws.amazon.com/thread.jspa?messageID=874055󕙇 )
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 126.96.36.199
Route 53 has an A record for www.example.com using an ALIAS to the cloudfront domain name: dxxxxxxx.cloudfront.net.
Route 53 has an A record for lightsail.example.com pointing to the lightsail static IP 188.8.131.52.
Cloudfront has an origin domain name of lightsail.example.com
Cloudfront Origin Protocol Policy is HTTP Only.
Cloudfront Alternate Domain Names is www.example.com
Cloudfront SSL Certificate is the one issued by Route53 for *.example.com.
Cloudfront Viewer Protocol Policy is Redirect HTTP to HTTPS.
Thanks for your time and expertise!
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?
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. https://www.example.com/ redirects to http://lighsail.example.com/ ). I'm expecting https://www.example.com/ 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!
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:https://aws.amazon.com/blogs/startups/how-to-accelerate-your-wordpress-site-with-amazon-cloudfront/ 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 (wordpress.openinfo.nl) 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 *.openinfo.nl). And I selected the cloudfront distribution as A record, type alias, in Route 53. The cloudfront Alternate Domain Names (CNAMEs) is service.openinfo.nl .
This solution does not work:
The cloudfront distribution service.openinfo.nl does resolve the lightsail server but over http, it does not use the certificate I attached... Should I use redirect http to https?
Also, if I click 'login' it redirects to "http://wordpress.openinfo.nl/wp-login.php" 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 wordpress.openinfo.nl.
And also, the DNS name wordpress.openinfo.nl resolves the lightsail server (which I don't want). How to avoid this?
So I also tried creating the service.openinfo.nl as A record (DNS) in Route 53 pointing to the static IP of the WordPress lightsail server. But then I cannot create the same service.openinfo.nl as alias A record...
So I am stuck... Please advice? Many thanks in advance! Wouter
PS: openinfo.nl points to a cloudfront distribution with a certificate which points to a static site in a S3 buckets and works fine.
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.
Unable to connect to Lightsail instance; now it's stuck "Stopping"asked 3 years ago
Lightsail wordpress instance refused to connect.asked 18 days ago
Moving to Cloudfront from LightSail Distributionasked a month ago
Can't connect to Lightsail instanceAccepted Answerasked 4 months ago
how to configure AWS cloudfront/distribution for plesk Ubuntu based wordpress website on lightsail instanceasked 3 months ago
lightsail ssh "connecting to instance..." can't connected to my instance with sshasked 6 months ago
How to connect a Lightsail instance to AWS CloudFront?asked 5 years ago
Cannot connect to Lightsail instancesasked 4 months ago
is it possible to transfer a lightsail instance to another account ?asked a year ago
Connect Lightsail instance to AWS instance in a private subnetasked 5 months ago