Can’t create ScalingPolicy – No scalable target registered

Question:

I’ve followed the example here but when I try to update my stack I get the following error:

All the examples and documentation Ive seen show the resource id as something like :

e.g.: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-applicationautoscaling-scalabletarget.html

I dont see how or where I can get the resource id in this format.

The CF looks like this:

The cluster is created in a separate stack so I have to export/import that.

Can anyone see what I’ve done wrong here?

TIA.

Answer:

Just ran into the same error,

Not too sure what @Jonesie means by adding them together, but there’s two ways to solve this:

Either add “DependsOn: AutoScalingTarget” to AutoScalingPolicy, so the scalable target gets created before the AutoScalingPolicy

Or use ScalingTargetId in stead of ServiceNamespace/ScalableDimension/ResourceId. By using ScalingTargetId and then !Ref AutoScalingTarget you’re setting up the dependency between the two resources, which is the actual problem 😉

See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-applicationautoscaling-scalingpolicy.html#cfn-applicationautoscaling-scalingpolicy-scalabledimension

Leave a Reply