Reputation: 421
I want to host website on S3 and application server on EC2.
I have a domain name from names cheap and added a 'A' record with '@' host pointing to elastic IP associated with my EC2 instance.
Also on EC2 instance i have tomcat running on port 8080
. When i send request to mydomain.com:8080/webservice
its working as expected. This webservice is for mobile applications nothing to do with static site, which i want to host on S3.
Now I want to configure mydomain.com
to S3 bucket. how do i do that?
Upvotes: 2
Views: 1658
Reputation: 421
It turns out the solution was to create two DNS records
1)CNAME "WWW" record to point www.mydomain.com.s3-website-us-east-1.amazonaws.com.
2)A Record "api" to ip address. This allows api.mydomain.com to point to elastic ip with point to ec2 instance
Upvotes: 3
Reputation: 19573
An apex record only supports A records which provide an IP address. If you use Route 53 to provide your DNS, you can set up an alias to a bucket, load balancer or other AWS services which will internally map to IP addresses.
The alias system only works with Route 53, you cannot do this with any other DNS provider.
Upvotes: 1
Reputation: 201048
You can't create an A record on namecheap that points to an S3 bucket. You have to use a CNAME record to point to an S3 bucket. You can't use a CNAME record for a root domain like "mydomain.com". You could setup a CNAME record on namecheap that points "www.mydomain.com" to your S3 bucket.
If you need to point the root of your domain (mydomain.com) to S3 you will have to move your DNS hosting to Route53 so that you can use an alias record, as detailed here.
Upvotes: 1
Reputation: 3414
Check out Example: Setting Up a Static Website Using a Custom Domain for the steps setting up a custom domain for a static website on S3.
Upvotes: 1