{"id":5904,"date":"2019-06-12T16:24:52","date_gmt":"2019-06-12T09:24:52","guid":{"rendered":"http:\/\/gcloudvn.wam.vn\/tiet-kiem-chi-phi-bang-cach-thiet-lap-lich-tu-dong-bat-tat-may-chu-compute-engine\/"},"modified":"2023-05-15T13:58:30","modified_gmt":"2023-05-15T06:58:30","slug":"tiet-kiem-chi-phi-bang-cach-thiet-lap-lich-tu-dong-bat-tat-may-chu-compute-engine","status":"publish","type":"post","link":"https:\/\/gcloudvn.com\/en\/kienthuc\/google-cloud-platform\/tiet-kiem-chi-phi-bang-cach-thiet-lap-lich-tu-dong-bat-tat-may-chu-compute-engine\/","title":{"rendered":"Save costs by setting up a schedule to automatically turn on\/off the Compute Engine server"},"content":{"rendered":"<p style=\"text-align: justify;\"><span style=\"font-weight: 400;\">A key feature of virtual servers (VMs) in the cloud is that you only pay for the resources you use. On Google Cloud Platform<\/span><span style=\"font-weight: 400;\">\u00a0(GCP), <\/span><a href=\"https:\/\/gcloudvn.com\/en\/compute-engine\/\"><span style=\"color: #0000ff;\"><span style=\"font-weight: 400;\">Compute Engine<\/span><\/span><\/a><span style=\"font-weight: 400;\"> 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&#039;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.<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400;\">Cloud Scheduler, helps schedule the above jobs <a href=\"https:\/\/gcloudvn.com\/en\/google-cloud-platform\/\">GCP<\/a>, provides a simple solution to automatically stop or start VMs. With Cloud Scheduler deployment with Cloud Pub\/Sub to enable Cloud Functions on a schedule, you can also enable or disable<\/span><span style=\"font-weight: 400;\"> VM clusters are marked via labels <\/span><span style=\"font-weight: 400;\">(created in Compute Engine).<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400;\">In the image below you can see the schedules (examples) to stop all VMs labeled \u201cdev\u201d at 5pm and restart at 9am, while those labeled \u201cprod\u201d &#039; is not affected.<\/span><\/p>\n<p style=\"text-align: justify;\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-14294 size-full\" src=\"https:\/\/gcloudvn.com\/wp-content\/uploads\/2019\/06\/unnamed-3.png\" alt=\"Save costs by setting up a schedule to automatically turn on\/off the Compute Engine server\" width=\"512\" height=\"272\" \/><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400;\">Using this setup allows great flexibility, you can assign different schedules to different VM clusters by creating multiple Cloud Schedulers.<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400;\">At the same time, it helps you have more control over Compute Engine VMs, because functions on GCP all use service accounts. <\/span><span style=\"font-weight: 400;\">\u0111\u1ec3 d\u1eebng ho\u1eb7c kh\u1edfi \u0111\u1ed9ng c\u00e1c m\u00e1y ch\u1ee7 VM Compute Engine. S\u1eed d\u1ee5ng Cloud Identity and Access Management (IAM)<\/span><span style=\"font-weight: 400;\">, you can follow the principle of least rights<\/span><span style=\"font-weight: 400;\">\u00a0and limit the permissions to the most necessary for this service account.<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400;\">When scheduling a system shutdown, VMs will execute shutdown scripts <\/span><span style=\"font-weight: 400;\">to ensure they are functioning properly. Any attached drives that disable auto-erase<\/span><span style=\"font-weight: 400;\">\u00a0will 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.<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400;\">To see an example of a deployment design, you can see more about Scheduling compute instances with Cloud Scheduler.<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400;\">To learn more about what you can do with Cloud Scheduler, see Reliable task scheduling on Compute Engine with Cloud Scheduler.<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400;\">If your business needs advice on information related to Google Cloud services. <\/span><span style=\"font-weight: 400;\">\u00a0Contact now:<\/span><\/p>\n<ul style=\"text-align: justify;\">\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Gimasys \u2013 Google Cloud Premier Partner<\/b><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Hotline: <\/b><span style=\"font-weight: 400;\">Hanoi: <\/span><span style=\"font-weight: 400;\">0987 682 505<\/span><span style=\"font-weight: 400;\"> - Ho Chi Minh: <\/span><span style=\"font-weight: 400;\">0974 417 099<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Email: <\/b>gcp@gimasys.com<\/li>\n<li aria-level=\"1\"><strong>Sign up for a trial: <a href=\"https:\/\/gcloudvn.com\/en\/dang-ky-dung-thu\/\" target=\"_blank\" rel=\"nofollow noopener\">Here<\/a><\/strong><\/li>\n<\/ul>\n<p style=\"text-align: right;\"><strong><a href=\"https:\/\/gcloudvn.com\/en\/\">Gimasys<\/a><\/strong><\/p>","protected":false},"excerpt":{"rendered":"<p>M\u1ed9t t\u00ednh n\u0103ng ch\u00ednh c\u1ee7a m\u00e1y ch\u1ee7 \u1ea3o (VMs) tr\u00ean cloud \u0111\u00f3 l\u00e0 b\u1ea1n ch\u1ec9 ph\u1ea3i tr\u1ea3 cho nh\u1eefng t\u00e0i nguy\u00ean n\u00e0o m\u00e0 b\u1ea1n s\u1eed d\u1ee5ng. Tr\u00ean Google Cloud Platform\u00a0(GCP), Compute Engine VMs \u0111\u01b0\u1ee3c t\u00ednh ti\u1ec1n theo t\u1eebng gi\u00e2y. H\u1ec7&hellip;<\/p>","protected":false},"author":1,"featured_media":5905,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[1,135],"tags":[],"class_list":["post-5904","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-kienthuc","category-google-cloud-platform","entry","has-media"],"_links":{"self":[{"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/posts\/5904","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/comments?post=5904"}],"version-history":[{"count":0,"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/posts\/5904\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/media\/5905"}],"wp:attachment":[{"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/media?parent=5904"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/categories?post=5904"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/tags?post=5904"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}