考虑在AWS Route53上注册的域.应从AWS CloudFront CDN分发中提供对此域的HTTP请求.为了实现这一点,定义了别名A记录:
挖掘结果
但是,挖掘结果显示实际的IP地址.实际上,这些IP地址不是恒定的,而是随时间变化的:
# dig @1.1.1.1 serverlessdaystlv.io ... ;; ANSWER SECTION: serverlessdaystlv.io. 60 IN A 13.32.67.21 serverlessdaystlv.io. 60 IN A 13.32.67.27 serverlessdaystlv.io. 60 IN A 13.32.67.97 serverlessdaystlv.io. 60 IN A 13.32.67.122 serverlessdaystlv.io. 60 IN A 13.32.67.141 serverlessdaystlv.io. 60 IN A 13.32.67.159 serverlessdaystlv.io. 60 IN A 13.32.67.201 serverlessdaystlv.io. 60 IN A 13.32.67.216 # dig @1.1.1.1 serverlessdaystlv.io ... ;; ANSWER SECTION: serverlessdaystlv.io. 60 IN A 52.222.232.13 serverlessdaystlv.io. 60 IN A 52.222.232.24 serverlessdaystlv.io. 60 IN A 52.222.232.43 serverlessdaystlv.io. 60 IN A 52.222.232.55 serverlessdaystlv.io. 60 IN A 52.222.232.63 serverlessdaystlv.io. 60 IN A 52.222.232.104 serverlessdaystlv.io. 60 IN A 52.222.232.136 serverlessdaystlv.io. 60 IN A 52.222.232.224
我的问题
什么是Route53别名记录?它是内置类型的DNS记录,还是仅用于CloudFront分配的实际IP的内部AWS别名,从不暴露给外部?
解决方法
别名记录是在更高级别上工作的内部Amazon特定指针;在技术DNS级别,它可能会导致A或CNAME,具体取决于具体情况. DNS不需要知道这个内部指针类型也不需要知道目标,因为Route53只回答结果记录.
亚马逊文章Choosing Between Alias and Non-Alias Records详细解释了这一点:
Alias records provide a Route 53–specific extension to DNS
functionality. Instead of an IP address or a domain name,an alias
record contains a pointer to a CloudFront distribution,an Elastic
Beanstalk environment,an ELB Classic,Application,or Network Load
Balancer,an Amazon S3 bucket that is configured as a static website,
or another Route 53 record in the same hosted zone. When Route 53
receives a DNS query that matches the name and type in an alias
record,Route 53 follows the pointer and responds with the applicable
value:
An alternate domain name for a CloudFront distribution – Route 53 responds as if the query had asked for the CloudFront distribution by
using the CloudFront domain name,such as
d111111abcdef8.cloudfront.net
.An Elastic Beanstalk environment – Route 53 responds to each request with one or more IP addresses for the environment.
An ELB load balancer – Route 53 responds to each request with one or more IP addresses for the load balancer.
An Amazon S3 bucket that is configured as a static website – Route 53 responds to each request with one IP address for the Amazon S3 bucket.
Another Route 53 record in the same hosted zone – Route 53 responds as if the query had asked for the record that is
referenced by the pointer.
混淆是可以理解的,因为您似乎在添加A类型的IPv4地址记录,而目标是主机名而不是IP地址;你宁愿和CNAME一起使用的东西!