Explain how CloudWatch Alarms can be used for autoscaling.

CloudWatch Alarms can trigger autoscaling actions based on predefined thresholds or conditions. For example, an alarm can be configured to scale up an Auto Scaling group when CPU utilization exceeds a certain threshold or scale down when traffic decreases. This helps ensure that the application maintains optimal performance and cost efficiency.