Reputation: 63
In the AWS Resource AWS::ApplicationAutoScaling::ScalableTarget
, how do I retrieve the value of ResourceId
which is the unique resource identifier that associated with the scaleable target?
The format used in the ResourceId property is service/cluster_name/service_name
.
Upvotes: 3
Views: 2354
Reputation: 22532
You are correct that the ResourceId property should be in the form service/<cluster_name>/<service_name>
.
Incidentally, (and to help future Googlers) the error message that you get when you use an incorrect ResourceId
or ScalableDimension
is:
Unsupported service namespace, resource type or scalable dimension
To achieve this in CloudFormation you can use a Fn::Join
for the ResourceId
. Here is a snippet of the Scalable target that I am using:
"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"
}
}
Upvotes: 2
Reputation: 63
I use the {"Fn::Join" : [ ":", [ "a", "b", "c" ] ]"} to get the value of the "ResourceId".
Upvotes: 0