检索可扩展目标的ResourceId

时间:2016-08-31 23:46:42

标签: amazon-ecs

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

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

2 个答案:

答案 0 :(得分:0)

我使用{" Fn :: Join" :[":",[" a"," b"," c" ]]"}获取" ResourceId"。

的值

答案 1 :(得分:0)

您确定ResourceId属性的格式应为ResourceId

顺便提一下,(以及帮助未来的Google员工)使用不正确的ScalableDimensionFn::Join时收到的错误消息是:

  

不支持的服务命名空间,资源类型或可伸缩维度

要在CloudFormation中实现此目的,您可以ResourceId使用"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" } } 。以下是我正在使用的可伸缩目标的片段:

"manager1": [
        {"product1":"xxxx"},
        {"product2":"yyyy"},
        {"product3":"zzzz"}
    ],
"manager2": [
        {"product1":"xxxx"},
        {"product2":"yyyy"},
        {"product3":"zzzz"}
    ]