Route53 subdomain alias for S3 bucket
I am trying to static webpage from S3 bucket.
Created S3 bucket test.dev.mydomain.com with following policy
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::test.dev.mydomain.com/*"
}
]
}
After this I was able to access the http://test.dev.mydomain.com.s3-website-us-west-1.amazonaws.com
Now I want to create DNS record under mydomain.com in route53. I tried to create following alias in Route53
Name : test.dev.mydomain.com
Type : A - IPv4 address(Tried CNAME too)
Alias : Yes
Alias Target : test.dev.mydomain.com.s3-website-us-west-1.amazonaws.com
but getting
- Alias Target contains an invalid value. while saving the record.
Update after John Rotenstein's answer :
Was able to select the bucket from the list after waiting more than 10 min and save the record.
Able to access http://test.dev.mydomain.com.s3-website-us-west-1.amazonaws.com
But still test.dev.mydomain.com giving 404 page not found
Update :
Recent finding is test.dev.mydomain.com works only in firefox, not any other browser.
amazon-web-services amazon-s3 amazon-route53 static-site
add a comment |
I am trying to static webpage from S3 bucket.
Created S3 bucket test.dev.mydomain.com with following policy
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::test.dev.mydomain.com/*"
}
]
}
After this I was able to access the http://test.dev.mydomain.com.s3-website-us-west-1.amazonaws.com
Now I want to create DNS record under mydomain.com in route53. I tried to create following alias in Route53
Name : test.dev.mydomain.com
Type : A - IPv4 address(Tried CNAME too)
Alias : Yes
Alias Target : test.dev.mydomain.com.s3-website-us-west-1.amazonaws.com
but getting
- Alias Target contains an invalid value. while saving the record.
Update after John Rotenstein's answer :
Was able to select the bucket from the list after waiting more than 10 min and save the record.
Able to access http://test.dev.mydomain.com.s3-website-us-west-1.amazonaws.com
But still test.dev.mydomain.com giving 404 page not found
Update :
Recent finding is test.dev.mydomain.com works only in firefox, not any other browser.
amazon-web-services amazon-s3 amazon-route53 static-site
did you try using cloudfront for serving your website ?
– varnit
Nov 30 '18 at 13:15
add a comment |
I am trying to static webpage from S3 bucket.
Created S3 bucket test.dev.mydomain.com with following policy
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::test.dev.mydomain.com/*"
}
]
}
After this I was able to access the http://test.dev.mydomain.com.s3-website-us-west-1.amazonaws.com
Now I want to create DNS record under mydomain.com in route53. I tried to create following alias in Route53
Name : test.dev.mydomain.com
Type : A - IPv4 address(Tried CNAME too)
Alias : Yes
Alias Target : test.dev.mydomain.com.s3-website-us-west-1.amazonaws.com
but getting
- Alias Target contains an invalid value. while saving the record.
Update after John Rotenstein's answer :
Was able to select the bucket from the list after waiting more than 10 min and save the record.
Able to access http://test.dev.mydomain.com.s3-website-us-west-1.amazonaws.com
But still test.dev.mydomain.com giving 404 page not found
Update :
Recent finding is test.dev.mydomain.com works only in firefox, not any other browser.
amazon-web-services amazon-s3 amazon-route53 static-site
I am trying to static webpage from S3 bucket.
Created S3 bucket test.dev.mydomain.com with following policy
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::test.dev.mydomain.com/*"
}
]
}
After this I was able to access the http://test.dev.mydomain.com.s3-website-us-west-1.amazonaws.com
Now I want to create DNS record under mydomain.com in route53. I tried to create following alias in Route53
Name : test.dev.mydomain.com
Type : A - IPv4 address(Tried CNAME too)
Alias : Yes
Alias Target : test.dev.mydomain.com.s3-website-us-west-1.amazonaws.com
but getting
- Alias Target contains an invalid value. while saving the record.
Update after John Rotenstein's answer :
Was able to select the bucket from the list after waiting more than 10 min and save the record.
Able to access http://test.dev.mydomain.com.s3-website-us-west-1.amazonaws.com
But still test.dev.mydomain.com giving 404 page not found
Update :
Recent finding is test.dev.mydomain.com works only in firefox, not any other browser.
amazon-web-services amazon-s3 amazon-route53 static-site
amazon-web-services amazon-s3 amazon-route53 static-site
edited Nov 27 '18 at 17:27
roy
asked Nov 21 '18 at 20:24
royroy
1,30563073
1,30563073
did you try using cloudfront for serving your website ?
– varnit
Nov 30 '18 at 13:15
add a comment |
did you try using cloudfront for serving your website ?
– varnit
Nov 30 '18 at 13:15
did you try using cloudfront for serving your website ?
– varnit
Nov 30 '18 at 13:15
did you try using cloudfront for serving your website ?
– varnit
Nov 30 '18 at 13:15
add a comment |
2 Answers
2
active
oldest
votes
I got this to work as follows:
- Created an Amazon S3 bucket in the ap-southeast-2 region
- Activated Static Website Sharing
- Created a Record Set in Route 53 with:
- DNS name that matches the bucket name
- Type: A
- Alias: Yes
- Alias Target: Selected bucket from list
Note: It took a long time (10 minutes?) before the bucket appeared in the list!
The format was:
- Bucket name:
foo.domain.com
- Alias Target:
s3-website-ap-southeast-2.amazonaws.com
Note that the target does not contain the bucket name! This is because the DNS name will resolve to S3, which will then use the full DNS name to determine the bucket name.
This is actually because the DNS name will resolve to a generic regional S3 endpoint, which will then use the HTTPHostheader sent by the browser to determine the bucket name. The original name in the query to Route 53 isn't preserved at the DNS layer.
– Michael - sqlbot
Nov 22 '18 at 3:23
Updated my my question.
– roy
Nov 22 '18 at 15:32
add a comment |
Chrome & Safari redirect all http to https and because of this http://test.dev.mydomain.com not working in Chrome & Safari. But http://test.dev.mydomain.com.s3-website-us-west-1.amazonaws.com was working.
I fixed this by adding CloudFront to this sub/domain and everything works on https
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53419966%2froute53-subdomain-alias-for-s3-bucket%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I got this to work as follows:
- Created an Amazon S3 bucket in the ap-southeast-2 region
- Activated Static Website Sharing
- Created a Record Set in Route 53 with:
- DNS name that matches the bucket name
- Type: A
- Alias: Yes
- Alias Target: Selected bucket from list
Note: It took a long time (10 minutes?) before the bucket appeared in the list!
The format was:
- Bucket name:
foo.domain.com
- Alias Target:
s3-website-ap-southeast-2.amazonaws.com
Note that the target does not contain the bucket name! This is because the DNS name will resolve to S3, which will then use the full DNS name to determine the bucket name.
This is actually because the DNS name will resolve to a generic regional S3 endpoint, which will then use the HTTPHostheader sent by the browser to determine the bucket name. The original name in the query to Route 53 isn't preserved at the DNS layer.
– Michael - sqlbot
Nov 22 '18 at 3:23
Updated my my question.
– roy
Nov 22 '18 at 15:32
add a comment |
I got this to work as follows:
- Created an Amazon S3 bucket in the ap-southeast-2 region
- Activated Static Website Sharing
- Created a Record Set in Route 53 with:
- DNS name that matches the bucket name
- Type: A
- Alias: Yes
- Alias Target: Selected bucket from list
Note: It took a long time (10 minutes?) before the bucket appeared in the list!
The format was:
- Bucket name:
foo.domain.com
- Alias Target:
s3-website-ap-southeast-2.amazonaws.com
Note that the target does not contain the bucket name! This is because the DNS name will resolve to S3, which will then use the full DNS name to determine the bucket name.
This is actually because the DNS name will resolve to a generic regional S3 endpoint, which will then use the HTTPHostheader sent by the browser to determine the bucket name. The original name in the query to Route 53 isn't preserved at the DNS layer.
– Michael - sqlbot
Nov 22 '18 at 3:23
Updated my my question.
– roy
Nov 22 '18 at 15:32
add a comment |
I got this to work as follows:
- Created an Amazon S3 bucket in the ap-southeast-2 region
- Activated Static Website Sharing
- Created a Record Set in Route 53 with:
- DNS name that matches the bucket name
- Type: A
- Alias: Yes
- Alias Target: Selected bucket from list
Note: It took a long time (10 minutes?) before the bucket appeared in the list!
The format was:
- Bucket name:
foo.domain.com
- Alias Target:
s3-website-ap-southeast-2.amazonaws.com
Note that the target does not contain the bucket name! This is because the DNS name will resolve to S3, which will then use the full DNS name to determine the bucket name.
I got this to work as follows:
- Created an Amazon S3 bucket in the ap-southeast-2 region
- Activated Static Website Sharing
- Created a Record Set in Route 53 with:
- DNS name that matches the bucket name
- Type: A
- Alias: Yes
- Alias Target: Selected bucket from list
Note: It took a long time (10 minutes?) before the bucket appeared in the list!
The format was:
- Bucket name:
foo.domain.com
- Alias Target:
s3-website-ap-southeast-2.amazonaws.com
Note that the target does not contain the bucket name! This is because the DNS name will resolve to S3, which will then use the full DNS name to determine the bucket name.
answered Nov 21 '18 at 22:11
John RotensteinJohn Rotenstein
71.9k781125
71.9k781125
This is actually because the DNS name will resolve to a generic regional S3 endpoint, which will then use the HTTPHostheader sent by the browser to determine the bucket name. The original name in the query to Route 53 isn't preserved at the DNS layer.
– Michael - sqlbot
Nov 22 '18 at 3:23
Updated my my question.
– roy
Nov 22 '18 at 15:32
add a comment |
This is actually because the DNS name will resolve to a generic regional S3 endpoint, which will then use the HTTPHostheader sent by the browser to determine the bucket name. The original name in the query to Route 53 isn't preserved at the DNS layer.
– Michael - sqlbot
Nov 22 '18 at 3:23
Updated my my question.
– roy
Nov 22 '18 at 15:32
This is actually because the DNS name will resolve to a generic regional S3 endpoint, which will then use the HTTP
Host header sent by the browser to determine the bucket name. The original name in the query to Route 53 isn't preserved at the DNS layer.– Michael - sqlbot
Nov 22 '18 at 3:23
This is actually because the DNS name will resolve to a generic regional S3 endpoint, which will then use the HTTP
Host header sent by the browser to determine the bucket name. The original name in the query to Route 53 isn't preserved at the DNS layer.– Michael - sqlbot
Nov 22 '18 at 3:23
Updated my my question.
– roy
Nov 22 '18 at 15:32
Updated my my question.
– roy
Nov 22 '18 at 15:32
add a comment |
Chrome & Safari redirect all http to https and because of this http://test.dev.mydomain.com not working in Chrome & Safari. But http://test.dev.mydomain.com.s3-website-us-west-1.amazonaws.com was working.
I fixed this by adding CloudFront to this sub/domain and everything works on https
add a comment |
Chrome & Safari redirect all http to https and because of this http://test.dev.mydomain.com not working in Chrome & Safari. But http://test.dev.mydomain.com.s3-website-us-west-1.amazonaws.com was working.
I fixed this by adding CloudFront to this sub/domain and everything works on https
add a comment |
Chrome & Safari redirect all http to https and because of this http://test.dev.mydomain.com not working in Chrome & Safari. But http://test.dev.mydomain.com.s3-website-us-west-1.amazonaws.com was working.
I fixed this by adding CloudFront to this sub/domain and everything works on https
Chrome & Safari redirect all http to https and because of this http://test.dev.mydomain.com not working in Chrome & Safari. But http://test.dev.mydomain.com.s3-website-us-west-1.amazonaws.com was working.
I fixed this by adding CloudFront to this sub/domain and everything works on https
answered Dec 7 '18 at 20:23
royroy
1,30563073
1,30563073
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53419966%2froute53-subdomain-alias-for-s3-bucket%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
did you try using cloudfront for serving your website ?
– varnit
Nov 30 '18 at 13:15