chore: import upstream snapshot with attribution
FreeBSD Smoke / FreeBSD Smoke (x86_64) (push) Has been cancelled
CI / Quality Guardrails (push) Has been cancelled
CI / Build & Test (macos-latest) (push) Has been cancelled
CI / Build & Test (ubuntu-latest) (push) Has been cancelled
CI / Build & Test (windows-latest) (push) Has been cancelled
CI / Format (push) Has been cancelled
CI / PowerShell Syntax (push) Has been cancelled
CI / Windows Cross-Target Check (Linux) (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 13:10:34 +08:00
commit a789495a98
1551 changed files with 718128 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
import boto3
INSTANCE_ID = "i-08214cf66cd3f80c7"
def handler(event, context):
ec2 = boto3.client("ec2", region_name="us-east-1")
state = ec2.describe_instances(InstanceIds=[INSTANCE_ID])["Reservations"][0]["Instances"][0]["State"]["Name"]
if state == "running":
ec2.stop_instances(InstanceIds=[INSTANCE_ID])
msg = f"Circuit breaker: stopped {INSTANCE_ID} (was {state})"
else:
msg = f"Circuit breaker: {INSTANCE_ID} already {state}"
sns = boto3.client("sns", region_name="us-east-1")
sns.publish(TopicArn="arn:aws:sns:us-east-1:302154194530:jcode-guard-warn",
Subject="jcode circuit breaker fired", Message=msg)
return {"message": msg}