0

I am new to GCP app engine -- I have a node.js app running on app engine flex. Currently Google is charging me over 3500 hours of flex instance core hours per month. They tell me I am using multiple instances that is why the large number of hours. However, I have limited the instance number in app.yaml file to 1 -- but seems its not working. Here is my app.yaml file, and use gcloud app deploy to deploy the app.

#Copyright 2017, Google, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# [START gae_quickstart_yaml]
runtime: nodejs
env: flex

network:
  session_affinity: true

# This sample incurs costs to run on the App Engine flexible environment.
# The settings below are to reduce costs during testing and are not appropriate
# for production use. For more information, see:
# https://cloud.google.com/appengine/docs/flexible/nodejs/configuring-your-app-with-app-yaml

manual_scaling:
  instances: 1
resources:
  cpu: 1
  memory_gb: 0.5
  disk_size_gb: 10
# [END gae_quickstart_yaml]

Shareq
  • 1
  • 1
  • 1
    Do you have other App Engine versions that still running at the same time with current version? – JM Gelilio Oct 07 '20 at 18:53
  • Side question: why do you use App Engine flex? What are your requirements? – guillaume blaquiere Oct 08 '20 at 07:15
  • @guillaumeblaquiere -- I use App Engine flex as I need socket.io support for my node.js application. – Shareq Oct 08 '20 at 07:48
  • @JohnMichaelG - I do not believe I have any other App Engine versions running at the same time. Only one version should be running. I just deploy with `gcloud app deploy` -- I assume this will kill the previous version and deploy a new version. – Shareq Oct 08 '20 at 07:56
  • Thanks for the update. I think Cloud Run can be compliant now, it support bi-directional streaming, and request time out are limited to 60 minutes now! So, it's not the topic. The @JohnMichaelG idea is the right one! If you don't have other services, and other active versions (with a 1 in the number of instance), I don't know where these extra charges come from! – guillaume blaquiere Oct 08 '20 at 07:58
  • `gcloud app deploy` command only will generate a new version but will NOT delete the previous version. You can use `gcloud app deploy --version=VERSION` to replace the previous version by this deployment if there's existing. Try to run `gcloud app versions list` to list and check all App Engine version in default service. – JM Gelilio Oct 08 '20 at 15:46
  • If you have double checked that this is your only service and all the aforementioned, then you can go to the [help](https://cloud.google.com/appengine/pricing#help) section in the App Engine - Pricing and report billing problems to Cloud Services by filling this [online form](https://support.google.com/code/go/cloud_billing). – Joss Baron Oct 08 '20 at 19:33
  • thank you @JohnMichaelG. That was exactly the problem. Every time I deployed a new version, it kept the previous version running while directing 100% of the traffic to the newest version. Even though there was not traffic to the older versions they were each holding one CPU instance thus multiplying my hours of usage. I wish Google billing was more clear on where these additional hours were coming from. Google billing department was also clueless when I called them. Would have same me some money if this was clear in their billing. At least the problem is solved now. – Shareq Oct 11 '20 at 18:06

1 Answers1

0

To answer this question, your 3500 hours of flex instance core hours per month came from the App Engine Flex old version deployed. Because The App Engine Flex runs on a Virtual Machine and whenever you deploy a new version using the command gcloud app deploy, the old one is still running even without a traffic. To replace the previous version the old version by the new deployment use the gcloud command:

  • gcloud app deploy --version=VERSION

Also to delete/stop the version, you can do this in Google Cloud Console(App Engine > Version) then check all the versions you want to delete/stop or via gcloud command:

  • gcloud app versions delete VERSIONS
  • gcloud app versions stop VERSIONS

If contacting Google Billing department still can't explain where the charges came from, I believe contacting the Google Cloud Tech Support might give more explanation for this.

JM Gelilio
  • 3,482
  • 1
  • 11
  • 23