I have a custom domain setup in route53 and using rout53 as domain service provider. I have a static page hosted in aws s3 bucket which I am using as the home page of the site. In route53 I have mapped the aws s3 url to my custom domain by adding alias records as per this document.
I also have some lambda functions, which serves html pages on requests. Now I am trying to map the api endpoint of these lambda functions to my custom domain.
The flow is mainly like this, when the user hits the home website i.e. xyz.com, the homepage is served from the s3 static site. When the user navigates to other page say xyz.com/products/productId, the html is served from the lambda function. I am able to follow and do most of the steps for mapping api gateway endpoint to custom domain, but it's at adding DNS records I am facing the issue and getting the error A record with specified name already exists, which is understandable as I have already added the A record for routing to s3 bucket for my root domain.
My question is, can I add multiple records for the same type A in aws? Or is there other way to approach this problem?
No, you can't do it this way. A DNS name can only resolve to one thing.
Instead, you could create a subdomain so that:
xyz.com --> Amazon S3 bucket
products.xyz.com --> API Gateway
You could pass the productId as a parameter (eg products.xyz.com/?productId=42).
Related
I have existing hosted zone and A record in AWS route 53. The A record is pointing to cloudfront distribution.
lets say the hosted zone name is abcd.ci.example.io. The A record name is same as hosted zone. I can access the web site at abcd.ci.example.io without any issue.
I also have AWS Gateway API with invoke url https://xxxxx.execute-api.us-west-2.amazonaws.com/dev I can access a particular API route from the browser using invoke url https://xxxxx.execute-api.us-west-2.amazonaws.com/dev/v1/healthcheck
I want to assign a custom domain name to invoke url. So I created a new CNAME record in the hosted zone as api.abcd.ci.example.io and set the value to https://xxxxx.execute-api.us-west-2.amazonaws.com/dev
But then when I try to access a route using https://api.abcd.ci.example.io/v1/healthcheck I get error This site can’t be reached
A simple command line ping to api.abcd.ci.example.io also returns error as Ping request could not find host api.abcd.ci.example.io. Please check the name and try again.
Below is list of records in hosted. There are couple of acm validation records as well for both the domains.
Before API Gateway will let you point your custom domain to it, you first have to setup the custom domain in API Gateway, which includes setting up the SSL certificate API Gateway will use for that custom domain.
I registered a domain on Route53 and I would like to use the same domain for both my front-end and the back-end (example xyz.com).
The whole infrastructure is hosted on AWS.
The font-end is an app hosted on S3 and fronted by cloudfront.
The back-end is served via API Gateway.
I created a record of type A to point the API Gateway endpoints and I now try to create a new record of type A to serve the front-end (point cloudfront) which doesn't allow me, returning the error:
A record with the specified name already exists.
What is the correct way to achieve having both the front-end and the back-end behind the same domain?
First of all, you can not create multiple A records like that.
As luk2302 said, the normal approach is use two domains. But if you want to keep the same domain for both FE and BE, you can use multiple path patterns of CloudFront to do the routing for you.
It will look like this: You have 1 CloudFront distribution, it will have 2 behaviors with 2 origins: S3 and API Gateway. The first behavior will have path pattern /api/* and it will point to API Gateway's Origin. And the default path pattern will go to S3's Origin
I have a website setup in E2E having cPanel with the domain https://example.com. The images for the website are stored in an s3 bucket in AWS.
My final goal is to make the images in the s3 to be accessible as https://images.example.com/cake.jpg
For this, I have created a cloudfront distribution in AWS and made the images to be accessible with the cloudfront URL https://d1234.cloudfront.net/cake.jpg. But the next part, I do not know how to map the subdomain images.example.com to d123.cloudfront.net. Should I use the Alternative domian name setting in cloudfront as shown in the image below. The domain is setup in E2E so I'm not sure what to add in the CNAME field there.
Or should I just create an A record in E2E to map images.example.com to d123.cloudfront.net. If so, how can I add the SSL to images.example.com and force the SSL redirect from http to https?
You actually need to do both.
First within CloudFront you need to add the Alternative Domain Name(s) that you would like to use for your CloudFront distribution. Make sure to generate a certificate in ACM within us-east-1 that covers the domains you're going to setup.
Once this has been applied within your DNS provider you then need to create a record with the exact domain name specified (in Route 53 this would be Alias, in other providers a CNAME) and then give it the value of the CloudFront domain name.
If the alternative domain name is not featured in your CloudFront distribution traffic will be denied when you attempt to resolve the domain.
For more information follow the Using Alternate Domain Names and HTTPS documentation.
I am having trouble setting up DNS with Namecheap pointing to a static html website hosted in AWS S3.
Bucket config:
Currently, I get "chrisrich.io redirected you too many times."
This is the direct bucket url:
https://s3-ap-southeast-2.amazonaws.com/chrisrich.io/index.html
AWS S3 bucket name:
DNS settings in Namecheap:
What am I doing wrong?
There are two things:
The DNS record in Namecheap is for www.chrisrich.io and it's resolving to S3.
dig www.chrisrich.io +short
chrisrich.io.s3-ap-southeast-2.amazonaws.com.
s3-r-w.ap-southeast-2.amazonaws.com.
52.95.134.34
To make it work with www.chrisrich.io, you need to have the bucket name exact same name as www.chrisrich.io.
You can create a bucket with name www.chrisrich.io and put the files there , it should allow you to access your website using www.chrisrich.io.
You cannot have CNAME record for Apex domain chrisrich.io , it means you need to see if (URL forwarding) option available in Namecheap and chrisrich.io to www.chrisrich.io.
Also, Website endpoint doesn't support HTTPS, if you're planning to make your website work on https, you'll need cloudfront.
Also, to make S3 website endpoint work using www.chrisrich.io, you need to change your DNS record, currently you're using the REST API name for the CNAME record, chrisrich.io.s3.ap-southeast-2.amazonaws.com --> this should be the name of S3 website endpoint otherwise, index page won't load automatically and you will need to access it using www.chrisrich.io/index.html
You need to change your bucket name from chrisrich.io to www.chrisrich.io
Then, it will work.
Thanks
I am trying to direct a URL request to an AWS S3 bucket.
So far I have done the following:
Create a bucket with the name app-name.app (domain is .app)
Make the bucket public and set property as a static website.
Website works fine when directly accessed through the S3 ARN.
Now I need to direct my (Godaddy) hosted domain name to this S3 bucket.
These are the steps I've taken:
Create a hosted zone in Route 53
Create record sets for A, NS and SOA types.
This is how it looks like:
After that I set the same NS server names in to Godaddy domain. I then also received an email from Godaddy stating that the nameservers have been changed.
However, I am not able to access the site through the domain name. It times out.
Appreciate some help figuring out what step I am missing.
Thank you.
1-Make sure your DNS changed correctly, by ping and trace.
2-Use DNS tools like mxtoolbox to check the records.
3-Add CNAME record with your S3 website public URL(It's different as S3 general URL), for example, add www.