skip to Main Content
Welcome to Gimasys!
Hotline: +84 974 417 099 (HCM) | +84 987 682 505 (HN) gcp@gimasys.com

Save costs by setting up a schedule to automatically turn on/off the Compute Engine server

A key feature of virtual servers (VMs) in the cloud is that you only pay for the resources you use. Above Google Cloud Platform (GCP), Compute Engine VMs are billed every second. The service system usually operates 24/7; However, there are still some cases where VMs, like for service development or testing environments, are usually only used during business hours. It's pointless to keep running these types of servers all night or on weekends, so you can turn off the service to save money. But manually stopping and starting large clusters of VMs on a daily basis can easily lead to mistakes and be difficult to control throughout the organization.

 

Cloud Scheduler, which helps with job scheduling on GCP, provides a simple solution to automatically stop or start VMs. With the implementation of Cloud Scheduler with Cloud Pub/Sub to trigger scheduled Cloud Functions, you can also on or off VM clusters are marked with label (created in Compute Engine).

 

In the image below you can see the schedules (examples) to stop all VMs labeled “dev” at 5pm and restart at 9am, while those labeled “prod” ' is not affected.

 

Save costs by setting up a schedule to automatically turn on/off the Compute Engine server

 

 

Using this setup allows great flexibility, you can assign different schedules to different VM clusters by creating multiple Cloud Schedulers.

 

It also gives you more control over Compute Engine VMs, because the functions on GCP are used service account to stop or start the VM Compute Engine servers. Use Cloud Identity and Access Management (IAM), you can follow the principle minimal rights and limit the permissions to the most necessary for this service account.

 

When scheduled to stop the system, the VMs will execute the shutdown scripts to make sure they are working properly. Any attached drives that disable auto delete will still retain the data and may be available as soon as the VM reboots. Last but not least, if someone needs to deploy or test VMs unexpectedly, you can simply remove the label from that VM temporarily or simply restart the VM if it has been disabled.

 

To see an example of implementation design, you can see more about Scheduling compute instances with Cloud Scheduler.

 

For more on what you can do with Cloud Scheduler, see more about Reliable task scheduling on Compute Engine with Cloud Scheduler.

Nếu doanh nghiệp của bạn cần tư vấn các thông tin liên quan dịch vụ Google Cloud.  Contact now:

  • Gimasys – Google Cloud Premier Partner
  • Hotline: Hanoi: 0987 682 505 - Ho Chi Minh: 0974 417 099
  • Email: gcp@gimasys.com

Gimasys.

Back To Top
0974 417 099