【问题标题】:Output ACM CNAME name + value via Cloudformation通过Cloudformation输出ACM CNAME名称+值
【发布时间】:2022-12-04 20:21:15
【问题描述】:

我正在尝试部署 ACM 请求,并希望在发送请求后获取表中显示的 CNAME 名称和 CNAME 值 - 所有这些都通过 Cloudformation 输出。

这可能吗?还是我错过了什么?

如果 CF 资源如下所示:

  MyCertificate: 
    Type: "AWS::CertificateManager::Certificate"
    Properties: 
      DomainName: "*.blstsecurity.com"
      ValidationMethod: DNS

输出块会是什么样子?

  CertificateManager:
    Description: Certificate manager CNAME output
    Value: ???? ???????????

(找不到我可以在输出上使用的任何与记录相关的变量)

【问题讨论】:

    标签: amazon-web-services amazon-cloudformation aws-certificate-manager


    【解决方案1】:

    没有直接的方法,尽管您可以使用 CustomResource 将证书 ARN 作为输入并将 CNAME 名称和值返回为 output

    import boto3
    import json
    import logging
    import cfnresponse
    
    def lambda_handler(event, context):
        certificate_arn = event["ResourceProperties"]["CertificateArn"]
        acm = boto3.client("acm")
        domain_validation_options = acm.describe_certificate(CertificateArn=certificate_arn)["DomainValidationOptions"]
    
        if event["RequestType"] == "Create":
            cfnresponse.send(event, context, cfnresponse.SUCCESS, {"DomainValidationOptions": domain_validation_options})
        elif event["RequestType"] == "Update":
            cfnresponse.send(event, context, cfnresponse.SUCCESS, {"DomainValidationOptions": domain_validation_options})
        elif event["RequestType"] == "Delete":
            cfnresponse.send(event, context, cfnresponse.SUCCESS, {})
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-09-29
      • 2022-11-26
      • 2019-03-21
      • 2020-02-21
      • 2017-08-14
      • 1970-01-01
      • 2019-08-01
      • 1970-01-01
      相关资源
      最近更新 更多