InvalidChangeBatch 400:“”不是有效的托管区域 ID。尝试将 A 记录添加到现有域时不是有效的加密标识符

InvalidChangeBatch 400: "" is not a valid hosted zone id. is not a valid encrypted identifier when attempting to add A record to existing domain

我正在尝试将我的域指向我的 S3 存储桶

当我尝试在我的域上创建 A 记录时,我在 Route53 控制台中收到以下错误:

Error occurred
Alias Target contains an invalid value.
(InvalidChangeBatch 400: "" is not a valid hosted zone id. is not a valid encrypted identifier)

我注意到,当我 select“ap-southeast-2”时,我的“bowls-holdingpage”存储桶不会预先填充,即使它肯定位于该区域并设置为托管静态站点。它在默认 S3 端点 URL 上托管站点,但我正在尝试将其切换为在我的域中添加 A 记录。

我哪里错了?

要将 R53 用于存储桶,存储桶名称必须与您的域匹配。来自 docs:

Amazon S3 bucket – The name of the record must match the name of your Amazon S3 bucket. For example, if the name of your bucket is acme.example.com, the name of this record must also be acme.example.com. In addition, you must configure the bucket for website hosting.

所以你的桶应该叫做bowls.com.au

我也遇到了这个问题。 我确实有与域同名的存储桶。

我在创建存储桶大约一个小时后发现,它突然在 'Choose S3 bucket' 下拉列表中可用。

我在存储桶设置中遗漏的另一件事是,起初我没有在 'Static website hosting' 中启用静态网站托管。

我在尝试创建指向 CloudFront 分配的 Route53 DNS A 记录时收到此错误消息。 (这是目前该错误消息的前 Google 个结果。)

我曾(错误地)假设需要将 CloudFront 发行版 的托管区域放入记录中,因为记录需要在其 AliasTarget 中有一个托管区域。但实际上我需要从 the Route53 documentation:

中输入 Z2FDTNDATAQYW2 的特殊魔法值 (!)
session = aioboto3.Session(...)
async with session.client('route53') as route53:
    route53_response = await route53.change_resource_record_sets(
        HostedZoneId=route53_hosted_zone_id,  # ex: A9E7TNDATAW749
        ChangeBatch={
            'Comment': f'CloudFront distribution for {domain_name}',
            'Changes': [
                {
                    'Action': 'CREATE',
                    'ResourceRecordSet': {
                        'Name': domain_name,  # ex: mysubdomain.example.com
                        'Type': 'A',
                        'AliasTarget': {
                            # https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/route53.html
                            'HostedZoneId': 'Z2FDTNDATAQYW2',  #  magic, for a CloudFront distribution
                            'DNSName': cloudfront_distribution_domain_name,  # ex: q1a91r2o7y8g32.cloudfront.net
                            'EvaluateTargetHealth': False,
                        },
                    },
                },
            ],
        },
    )