MCPcopy
hub / github.com/doctorray117/minecraft-ondemand / lambda_handler

Function lambda_handler

lambda/lambda_function.py:16–35  ·  view source on GitHub ↗

Updates the desired count for a service.

(event, context)

Source from the content-addressed store, hash-verified

14
15
16def 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")

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected