ACM 在 Lambda 函数中描述证书并获取 DomainValidationOptions 的值
ACM Describe Certificate and get values of DomainValidationOptions in Lambda Function
我正在使用 ARN 描述 ACM 证书,但我无法导出 DomainValidationOptions 的值,如下面的代码所示,
acm_describe = client_acm.describe_certificate(
CertificateArn=acm_arn
)
acm_name = acm_describe['Certificate'][0]['DomainValidationOptions']['ResourceRecord']['Name']
acm_type = acm_describe['Certificate'][0]['DomainValidationOptions']['ResourceRecord']['Type']
acm_value = acm_describe['Certificate'][0]['DomainValidationOptions']['ResourceRecord']['Value']
我收到这个错误:
0: KeyError
Traceback (most recent call last):
File "/var/task/lambda_function.py", line 194, in lambda_handler
acm_name = acm_describe['Certificate'][0]['DomainValidationOptions']['ResourceRecord']['Name']
KeyError: 0
请指导我如何导出这些值,我必须在 lambda 函数中使用这些值进行 DNS 验证
你的[0]
放错地方了。应该是:
acm_name = acm_describe['Certificate']['DomainValidationOptions'][0]['ResourceRecord']['Name']
我正在使用 ARN 描述 ACM 证书,但我无法导出 DomainValidationOptions 的值,如下面的代码所示,
acm_describe = client_acm.describe_certificate(
CertificateArn=acm_arn
)
acm_name = acm_describe['Certificate'][0]['DomainValidationOptions']['ResourceRecord']['Name']
acm_type = acm_describe['Certificate'][0]['DomainValidationOptions']['ResourceRecord']['Type']
acm_value = acm_describe['Certificate'][0]['DomainValidationOptions']['ResourceRecord']['Value']
我收到这个错误:
0: KeyError
Traceback (most recent call last):
File "/var/task/lambda_function.py", line 194, in lambda_handler
acm_name = acm_describe['Certificate'][0]['DomainValidationOptions']['ResourceRecord']['Name']
KeyError: 0
请指导我如何导出这些值,我必须在 lambda 函数中使用这些值进行 DNS 验证
你的[0]
放错地方了。应该是:
acm_name = acm_describe['Certificate']['DomainValidationOptions'][0]['ResourceRecord']['Name']