Reputation: 1
I need to reduce cost in Google Cloud AppEngine Flex account. I need to automatically start instances in operating hours, then stop them at night. All of this every day. I have found information about Compute Engine, but nothing about AppEngine.
Upvotes: 0
Views: 1023
Reputation: 76093
You can't scale to 0 your App Engine flex. You need to consider other product (App Engine standard or Cloud Run) that scale to 0 automatically or to redesign your architecture.
You can imagine to deploy on Compute Engine and thus to use Cloud Scheduler to scedule the stop and the start.
If you really want to use App Engine Flex, it's more difficult, because, when you are on the default service, you can't delete all versions, at least need to be served. The idea here is to deploy 2 services on App Engine:
The idea is to promote 100% of the traffic the evening to the Standard version to offload the App Engine flex and to pay nothing during the night. In the morning, to promote 100% of the traffic to the Flex version.
Upvotes: 1
Reputation: 161
App Engine provides the capacity to scale down and up based on application metrics.
Automatic scaling
Automatic scaling creates instances based on request rate, response latencies, and other application metrics. You can specify thresholds for each of these metrics, as well as a minimum number instances to keep running at all times.
To archive this, you need to configure your App.yaml and adding the automatic_scaling
option.
automatic_scaling:
min_num_instances: 1
max_num_instances: 15
cool_down_period_sec: 180
cpu_utilization:
target_utilization: 0.6
target_concurrent_requests: 100
You can adjust the parameters in min_num_instances
and max_num_instances
to a value of 1 (or greater) in order to match your budget and your billing needs
Upvotes: 0