【问题标题】:Retrieving the ResourceId of a scaleable target检索可扩展目标的 ResourceId
【发布时间】:2016-12-09 01:18:05
【问题描述】:

在 AWS 资源 AWS::ApplicationAutoScaling::ScalableTarget 中,如何检索与可扩展目标关联的唯一资源标识符 ResourceId 的值?

ResourceId 属性中使用的格式是service/cluster_name/service_name

【问题讨论】:

    标签: amazon-ecs


    【解决方案1】:

    ResourceId 属性应采用service/<cluster_name>/<service_name> 的形式是正确的。

    顺便说一句,(为了帮助未来的 Google 员工)当您使用不正确的 ResourceIdScalableDimension 时收到的错误消息是:

    不支持的服务命名空间、资源类型或可扩展维度

    要在 CloudFormation 中实现此目的,您可以将 Fn::Join 用于 ResourceId。这是我正在使用的 Scalable 目标的 sn-p:

    "ECSServiceScalableTarget": {
        "Type": "AWS::ApplicationAutoScaling::ScalableTarget",
        "Properties": {
            "MaxCapacity": 5,
            "MinCapacity": 1,
            "ResourceId": { "Fn::Join" : ["/", [
                "service",
                { "Ref": "ECSCluster" },
                { "Fn::GetAtt" : ["ECSService", "Name"] }
            ]]},
            "RoleARN": { "Fn::Join" : ["", ["arn:aws:iam::", { "Ref" : "AWS::AccountId" }, ":role/ApplicationAutoscalingECSRole"]]},
            "ScalableDimension": "ecs:service:DesiredCount",
            "ServiceNamespace": "ecs"
        }
    }
    

    【讨论】:

      【解决方案2】:

      我使用 {"Fn::Join" : [ ":", [ "a", "b", "c" ] ]"} 来获取“ResourceId”的值。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-09-30
        • 2012-08-04
        • 2012-12-16
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多