等待 ChangeResourceRecordSetsAsync 在尝试创建 Route53 DNS 记录时永远挂起

Await for ChangeResourceRecordSetsAsync hangs forever when trying to create Route53 DNS record

我正在尝试在 AWS Route53 中创建 TXT 记录,但在等待调用时,它永远不会完成。

记录未在托管区域中创建。该帐户具有我使用 AWS CLI 测试的正确权限。

我能够列出托管区域,如下面的代码所示。

public static async Task CreateRecordAsync()
{
    var route53Client = new AmazonRoute53Client("<myAccessKey>", "<mySecretKey>", RegionEndpoint.EUCentral1);

    var test = new ListHostedZonesByNameRequest();
    var testResponse = route53Client.ListHostedZonesByNameAsync(test);

    foreach (var zone in testResponse.Result.HostedZones)
    {
        Console.WriteLine($"{zone.Name}{zone.Id}");
    }

    var response = await route53Client.ChangeResourceRecordSetsAsync(new ChangeResourceRecordSetsRequest
    {
        ChangeBatch = new ChangeBatch
        {
            Changes = new List<Change> {
                new Change {
                    Action = "CREATE",
                    ResourceRecordSet = new ResourceRecordSet {
                        Name = "my.domain.net",
                        Type = "TXT",
                        TTL = 60,
                        ResourceRecords = new List<ResourceRecord> 
                        { 
                            new ResourceRecord 
                            { 
                                Value = "test txt value" 
                            } 
                        }
                    }
                }
            },
            Comment = "Test Entry"
        },
        HostedZoneId = "Z2Q***********"
    });
}

问题是 TXT 记录必须用双引号引起来。我只需要捕获正确的异常。

try
{
    ....
    ChangeResourceRecordSetsResponse recordsetResponse = 
        await route53Client.ChangeResourceRecordSetsAsync(recordsetRequest);
    ....
}
catch (InvalidChangeBatchException ex)
{
    Console.WriteLine(ex);
}

这意味着我应该使用这样的方式构建我的记录。

ResourceRecordSet recordSet = new ResourceRecordSet
{
    Name = chosenDomain,
    TTL = 60,
    Type = RRType.TXT,
    ResourceRecords = new List<ResourceRecord> 
    { 
        new ResourceRecord 
        { 
            Value = "\"This is my test txt record\"" 
        } 
    }
};