AWS不支持匹配的顶级域名和S3存储桶静态网站

huangapple go评论63阅读模式
英文:

AWS match unsupported TLD domain name and S3 bucket static website

问题

我创建了一个AWS S3存储桶作为静态网站。一切都运行得很完美。我获得了以下链接:

http://my-bucket-name.s3-website-us-east-1.amazonaws.com

我拥有自己的域名,由本地注册商注册,它已经在运行:

my-site.kiev.ua

这个域名有一些DNS服务器设置:

名称服务器1 ns1.servername.com
名称服务器2 ...
名称服务器3 ...

据我了解,我不能将'kiev.ua'乌克兰域名迁移到AWS。当我尝试时,我收到了以下消息:

UnsupportedTLD aws

那么,如何将这个域名与AWS S3存储桶的静态网站匹配起来?我需要做什么?

英文:

I created aws S3 bucket as static web site. Everything works perfect. I've got the link like:

http://my-bucket-name.s3-website-us-east-1.amazonaws.com

I have my own domain registred by local registrator, it's already works:

my-site.kiev.ua

This domain has some DNS servers settings

Name-server-1 ns1.servername.com
Name-server-2 ...
Name-server-3 ...

As I understand, I couldn't move 'kiev.ua' ukranian domain to aws. When I tried, I've got the masssage:

UnsupportedTLD aws

How can I match this domain with aws S3 bucket static web site then? What I have to do?

答案1

得分: 1

不必在AWS中拥有DNS即可通过您的域名提供网站。

更简单的选择:
在您的DNS提供商处创建一个CNAME记录,并将其指向您拥有的S3存储桶的网站URL。不确定,但您可能会遇到SSL问题,因为S3网站没有HTTPS。

更好的选择:

  1. 为您的网站创建ACM证书(您需要在您的DNS提供商中添加记录以确认它)。
  2. 创建一个CloudFront分发,将Origin指向您的S3存储桶。
  3. 为您的分发设置备用域名为my-site.kiev.ua
  4. 复制AWS生成的CloudFront分发DNS名称,并在您的DNS提供商处为my-site.kiev.ua添加一个CNAME记录,将其指向此DNS名称。
英文:

You don't have to have a DNS in AWS to be able to serve a website through your domain.

Simpler option:
Create a CNAME record at your DNS provider and point it to the website URL of the S3 bucket that you have. Not 100% sure, but you might have an SSL problem because the S3 website doesn't have HTTPS

Better option:

  1. Create the ACM certificate for your website (you will need to add a record in your DNS provider to confirm it)
  2. Create a CloudFront distribution with Origin pointing to your S3 bucket.
  3. Set Alternate Domain Name for your Distribution to my-site.kiev.ua
  4. Copy the CloudFront Distribution DNS name that AWS generates and add a CNAME record in your DNS provider for my-site.kiev.ua to point to this DNS name

答案2

得分: 0

这是关于HTTP协议的答案。
创建一个名为my-site.kiev.ua的S3存储桶,设置为公共访问,并添加S3存储桶策略(将[YOUR_BUCKET_NAME]替换为您的实际存储桶名称):

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "PublicReadGetObject",
      "Effect": "Allow",
      "Principal": "*",
      "Action": "s3:GetObject",
      "Resource": "arn:aws:s3:::[YOUR_BUCKET_NAME]/*"
    }
  ]
}

然后保存并将静态网站托管设置为true。
创建名为www.my-site.kiev.ua的存储桶,不要设置完全访问权限,只需在静态网站托管部分添加重定向设置,指向先前的存储桶。

然后进入Route 53 -> 托管区域 -> 创建托管区域。命名为my-site.kiev.ua(公共托管区域)。
您将看到两个类型为NS和SOA的新字段。从NS Value/Route traffic复制4个值,逐个与您的DNS服务器设置匹配(不在AWS上,在域名提供商侧)。
然后按下以下步骤操作:

创建记录 -> 简单路由 -> 定义简单记录 -> 与S3存储桶my-site.kiev.ua匹配 -> 创建记录

最后,为www连接创建相同的记录。

英文:

This is the answer for http protocol.
Create S3 bucket my-site.kiev.ua with public access and add S3 bucket policy (replace '[YOUR_BUCKET_NAME]' with your actual bucket name):

{
  "Version": "2012-10-17",
  "Statement": [
    {
       "Sid": "PublicReadGetObject",
        "Effect": "Allow", 
        "Principal": "*", 
        "Action": "s3:GetObject", 
        "Resource": "arn:aws:s3:::[YOUR_BUCKET_NAME]/*" 
  } ] 
}

Then save and set static website hosting true.
Create www.my-site.kiev.ua bucket without full access, just add redirect settings to previous bucket in static website hosting part.

Then go to Route 53 -> Hosted zones -> Create hosted zone. Name my-site.kiev.ua (Public hosted zone)
You will see new to fields with types NS and SOA. Copy 4 values from NS Value/Route traffic to and field by field match them with yours DNS-server settings (not in aws, on domain provider side).
Then press

Create record -> Simple routing -> Define simple record -> Match with S3 bucket my-site.kiev.ua -> Create records

And finally create the same record for www connection

huangapple
  • 本文由 发表于 2023年6月18日 21:42:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/76500850.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定