【问题标题】:TargetGroup object does not support attribute TargetGroupAttributeTargetGroup 对象不支持属性 TargetGroupAttribute
【发布时间】:2021-08-21 00:03:30
【问题描述】:

我使用 Troposphere 和 Python 创建了一个 AWS NLB。它工作正常,我只是想向它添加一个新属性。我要添加的属性是“deregistration_delay.connection_termination.enabled”。但是当我尝试更新我的节时,它不喜欢我的语法。

这是我尝试添加的带有 TargetGroupAttribute 的代码块。

my_target_group = t.add_resource(elb.TargetGroup(
    "MyTargetGroup",
    Name = 'MyTGName',
    Port = os.getenv('PORT'),
    Protocol = os.getenv('PROTOCOL'),
    VpcId = MyVPCid.id,
    HealthCheckIntervalSeconds = os.getenv('HEALTH_CHECK_INTERVAL_SECONDS'),
    HealthCheckPort = os.getenv('PORT'),
    HealthCheckProtocol = os.getenv('HEALTH_CHECK_PROTOCOL'),
    HealthyThresholdCount = os.getenv('HEALTHY_THRESHOLD_COUNT'),
    UnhealthyThresholdCount = os.getenv('UNHEALTHY_THRESHOLD_COUNT'),
    TargetGroupAttribute = [
        elb.TargetGroupAttribute(
            Key='deregistration_delay.connection_termination.enabled',
            Value='true'
        )
    ],
    Targets = build_tg_desc_lst(list_of_instances, os.getenv('PORT'))
))

它不喜欢我分享的代码块的“TargetGroupAttribute”部分。我收到错误“TargetGroup 对象不支持属性 TargetGroupAttribute”。

AWS 文档是我用来添加属性的here

任何建议或帮助将不胜感激。谢谢!

【问题讨论】:

    标签: python amazon-web-services troposphere aws-nlb


    【解决方案1】:

    我能够解决问题。我不确定为什么会这样,但我能够成功部署 NLB,并通过以下方式启用了 Deregistration 属性。

    原始码

    TargetGroupAttribute = [
            elb.TargetGroupAttribute(
                Key='deregistration_delay.connection_termination.enabled',
                Value='true'
            )
        ]
    

    新代码

    TargetGroupAttributes = [
            elb.TargetGroupAttribute(
                Key='deregistration_delay.connection_termination.enabled',
                Value='true'
            )
        ]
    

    通过在变量末尾添加“s”解决了该问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-08-14
      • 2015-04-14
      • 2011-01-04
      • 2020-09-03
      • 2015-04-09
      • 2014-01-12
      • 2016-08-20
      相关资源
      最近更新 更多