Python 在HostedZone资源的Lambda函数中指定nameserver?
这是我的Lambda函数:Python 在HostedZone资源的Lambda函数中指定nameserver?,python,aws-lambda,sdk,amazon-cloudformation,Python,Aws Lambda,Sdk,Amazon Cloudformation,这是我的Lambda函数: Code: ZipFile: | import boto3 var client = boto3.client('route53domains') response = client.update_domain_nameservers( DomainName='example.com', Nameservers=[
Code:
ZipFile: |
import boto3
var client = boto3.client('route53domains')
response = client.update_domain_nameservers(
DomainName='example.com',
Nameservers=[
{
'Name': 'string',
]
},
]
)
它应该做的是更新Route53上我注册域的名称服务器我只是不知道如何为它指定名称服务器,这是我的CloudFormation堆栈中Lambda资源的一部分,我有一个资源HostedZone,我想导入!GetAtt HostedZone.NameServers
用于此函数
HostedZone.NameServer不会返回一个包含4个NameServer的列表,函数会要求输入一个字符串,因此我想我需要添加4个字符串。我迷路了。您可以使用将您的HostedZone.NameServers
传递到lambda源代码中:
Code:
ZipFile: !Sub |
import boto3
var client = boto3.client('route53domains')
response = client.update_domain_nameservers(
DomainName='example.com',
Nameservers=[
{
'Name': '${HostedZone.NameServers}',
]
},
]
)
以上只是一个例子。我不确定您到底想在哪里使用
HostedZone.NameServers
,但当使用Sub
时,正确的引用方式是${HostedZone.NameServers}
。Hi。我注意到你有很多问题和答案,但没有一个被接受。接受好的答案是一种很好的做法,因为它可以阻止人们提出重复的问题。如果好的答案不被接受,重复的问题被发布在错误的假设上,即现有的答案是不正确的。通常他们从不回答,或者当他们回答时,他们的答案根本没有帮助。在SDK文档中,它说此函数将替换注册域的当前名称服务器,但我不确定HostedZone.NameServers的输出是否正确列出,即使它是如何适合Python中的字符串的变量?@Katran鼠疫它不会是一个列表,您必须在函数中自己解析它到列表中