Updates the desired count for a service.
(event, context)
| 14 | |
| 15 | |
| 16 | def lambda_handler(event, context): |
| 17 | """Updates the desired count for a service.""" |
| 18 | |
| 19 | ecs = boto3.client('ecs', region_name=REGION) |
| 20 | response = ecs.describe_services( |
| 21 | cluster=CLUSTER, |
| 22 | services=[SERVICE], |
| 23 | ) |
| 24 | |
| 25 | desired = response["services"][0]["desiredCount"] |
| 26 | |
| 27 | if desired == 0: |
| 28 | ecs.update_service( |
| 29 | cluster=CLUSTER, |
| 30 | service=SERVICE, |
| 31 | desiredCount=1, |
| 32 | ) |
| 33 | print("Updated desiredCount to 1") |
| 34 | else: |
| 35 | print("desiredCount already at 1") |
nothing calls this directly
no outgoing calls
no test coverage detected