|
@@ -1,5 +1,6 @@
|
|
import logging
|
|
import logging
|
|
|
|
|
|
|
|
+import boto3
|
|
import cachetools
|
|
import cachetools
|
|
import yt_dlp
|
|
import yt_dlp
|
|
from flask import Flask, request
|
|
from flask import Flask, request
|
|
@@ -96,5 +97,24 @@ def health():
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+@app.route("/refresh", methods=["GET"])
|
|
|
|
+def refresh():
|
|
|
|
+ autoscaling = boto3.client(
|
|
|
|
+ 'autoscaling',
|
|
|
|
+ region_name="us-east-1",
|
|
|
|
+ aws_access_key_id="AKIA2TBT2JUNG6X3W737",
|
|
|
|
+ aws_secret_access_key="JhXpndfIrh+hFZHwHkYcVmFb+vziHyl9Z3eniXKo")
|
|
|
|
+ response = autoscaling.start_instance_refresh(
|
|
|
|
+ AutoScalingGroupName="be-ytb-as",
|
|
|
|
+ Strategy="Rolling",
|
|
|
|
+ Preferences={
|
|
|
|
+ "MinHealthyPercentage": 110,
|
|
|
|
+ "InstanceWarmup": 120
|
|
|
|
+ })
|
|
|
|
+ return {
|
|
|
|
+ "response": response
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
if __name__ == '__main__':
|
|
if __name__ == '__main__':
|
|
app.run(host='0.0.0.0', port=80, debug=True)
|
|
app.run(host='0.0.0.0', port=80, debug=True)
|