[TOC]
This solution uses a FunctionGraph timer trigger to periodically start and stop Elastic Cloud Servers (ECSs). You can stop unused ECSs, and later start them when needed to reduce operations costs.
For more details about this solution, visit: https://www.huaweicloud.com/intl/en-us/solution/implementations/secsss.html
This solution will:
-
Create two functions in FunctionGraph to call the ECS APIs for periodically starting and stopping ECSs.
-
Create a timer to periodically invoke the function code.
-
Create an agency in Identity and Access Management (IAM) to delegate FunctionGraph to access ECS in the relevant region.
huaweicloud-solution-scheduled-power-on-and-power-off-solution
├── scheduled-power-on-and-power-off-solution.tf.json -- Resource orchestration template
├── functiongraph
├── batch-start-ecs-at-scheduled-time.py -- Function file (startup)
├── batch-stop-ecs-at-scheduled-time.py -- Function file (shutdown)
-
Go to the FunctionGraph console, and view the created functions in the function list.
Figure1 Created functions
-
On the details page of each function, view the created trigger.
Figure2 Startup trigger
Figure3 Shutdown trigger
-
On the Monitoring tab, check that each trigger started or stopped the specified ECSs at the specified time.
Figure4 Request logs