diff --git a/moto/autoscaling/models.py b/moto/autoscaling/models.py index d54c39d71..a47eac779 100644 --- a/moto/autoscaling/models.py +++ b/moto/autoscaling/models.py @@ -440,6 +440,13 @@ class AutoScalingBackend(BaseBackend): self.elb_backend.register_instances(elb.name, group_instance_ids - elb_instace_ids) self.elb_backend.deregister_instances(elb.name, elb_instace_ids - group_instance_ids) + def create_or_update_tags(self, tags): + for tag in tags: + group_name = tag["ResourceId"] + group = self.autoscaling_groups[group_name] + updated_tags = group.tags.copy() + updated_tags.update(tag) + group.tags = updated_tags autoscaling_backends = {} for region, ec2_backend in ec2_backends.items(): diff --git a/moto/autoscaling/responses.py b/moto/autoscaling/responses.py index 79cb6aeee..b3ec57f27 100644 --- a/moto/autoscaling/responses.py +++ b/moto/autoscaling/responses.py @@ -105,6 +105,11 @@ class AutoScalingResponse(BaseResponse): template = self.response_template(SET_DESIRED_CAPACITY_TEMPLATE) return template.render() + def create_or_update_tags(self): + tags = self._get_param('Tags') + self.autoscaling_backend.create_or_update_tags(tags) + return None + def describe_auto_scaling_instances(self): instance_states = self.autoscaling_backend.describe_autoscaling_instances() template = self.response_template(DESCRIBE_AUTOSCALING_INSTANCES_TEMPLATE)