ec2_metric_alarm: Improve changed test for dimensions.

- Handle the case where old and new dimensions have different keys.
- Break early as soon as we know that the dimensions change.