Google App Engine Cost Optimization

Ritul Rai
2 min readJan 14, 2021

Google App Engine is a Platform as a Service and cloud computing platform for developing and hosting web applications in Google-managed data centers. Applications are sandboxed and run across multiple servers.

With Google App Engine, you only pay for the resources that you use beyond the free quotas. After you exceed the free quotas, your costs will scale with the amount of traffic your application receives.

Below are some basic rules and guidelines while using Google App Engine service to optimize the cost:

1. Reduce number of Instances

  • We can cut our cost by launching minimum instead (say one here) instead of two or three. Do this by turning on auto scaling and setting the instances to minimum number.
  • Avoid using high number of minimum instances. Start with one instance, analyze your application need and auto-scale it to desired number of maximum number of instances. Please see below reference app yaml snippet. This helps in avoiding unnecessary cost.

2. Use small instance class

  • Most important thing is to analyze and then identify your application load and need and based on that choose the right fit instance class.
  • Try to analyse need (memory + cpu) for your application and use right instance class instance of blindly using largest instance class based on hit and trail.
  • Please try avoiding largest instance class highlighted above untill or unless your really need it for your very high load of the application. Each instances class cost very higher than its next smaller instance.

3. Spin down dev instances

  • If you are working on local development, chances are you don’t need it running 24/7. By default, App Engine will deploy a new version every time. This makes rolling back to an old version or traffic splitting and A/B testing super easy, but is not needed for local development.
  • When you are finished working for the day, you can spin down your instance with the following command to save unnecessary cost

$ gcloud app versions stop dev

And you can start it back up just as easily:

$ gcloud app versions start dev

4. Cleanup unused services and deployments

  • Delete deployment and services immediate after local testing. Please do not keep this running and leave idle. Cleanup resources right after local development, deployment and testing.
  • Cleanup any unused or deprecated service to reduce any extra incurred cost.

--

--