· 5 min read

Table of Contents

Being a developer we always look for a development platform that’s easy to use, and at the same time, we want to make sure it’s going to scale up after it becomes big. Also, want to pick the language we’re most comfortable with. And of course, we don’t want to think too much about monitoring and operations. So, this is where App Engine comes into the picture and saves the day.

What is Google App Engine and why is it used?

App Engine is a managed application platform that supports any language, framework, or library we want to use. We don’t need to worry about the infrastructure, so we can focus more on the code. We can get started anytime with any language like Node.js, Ruby, PHP, Go, Java, Python, or even .NET. And if that’s not enough, we can bring our own custom container using any programming language or library.

Features of App Engine:

Supported Popular Languages: You can start with any language you’re comfortable with App Engine supports almost every popular language like Node.js, Ruby, PHP, Go, Java, Python, C#, or even .NET and apart from this it also supports other programming languages which are not listed through custom runtimes.

Open & Flexible: Custom run times in the google app engine allows you to bring any library and framework to the app engine by supplying a docker container so you can customize runtimes or provide your own runtime by supplying a customer talker image or docker file from the open source community

Fully Managed: App Engine is a fully managed serverless application platform that lets you focus on your code while it manages the infrastructure. It takes care of uploading your code and running it on Google’s infrastructure.

App Engine Monitoring Capabilities

Application Diagnostics: Being able to debug and monitor applications, even in production, is just as important as deploying code. App Engine integrates seamlessly with Google Stackdriver diagnostics. Monitoring, logging, debugging, and tracing it’s all available out of the box with minimal setup and configuration.

Application Versioning: You can run multiple versions of your application at the same time and can even split traffic between different versions of your app, making it simple to perform rollouts or A/B testing.

Application Security: As infrastructure is already managed by App Engine, one of the main concerns, security has also been taken care of by Google with App Engine firewall and leverage managed SSL/TLS certificates.

Getting started with App Engine

To deploy an app to an App Engine make sure to create a Google Cloud project and App Engine application resources if you don’t have them already. Then if you want to deploy a web app first create or clone all your required files for the web app and then simply run gcloud app deploy command from the main directory of the project, where app.yaml the file is located.

app engine, reduce app engine cost, manage app engine cost

To check whether it’s deployed properly or not you can run gcloud app browse command to generate a URL for your web service, which will look like this https://PROJECT_ID.REGION_ID.r.appspot.co, and if you want to change the URL other than something default you can add a custom domain.

app engine, google app engine, gcloud cost optimization, app engine optimization, reduce app engine cost, manage app engine cost

Understanding App Engine Pricing

Now, let’s understand how App Engine is billed and the costs involved in that. There are two types of environments available for App Engine and for both the charges and factors of charging are different one is the standard environment and another is the flexible environment. In a standard environment, pricing depends upon the instance class you choose for your app. The instance class shows the amount of CPU and memory available to each instance. For instance, Memory and CPU Limits are defined with class.

Google App Engine Cost Model & Pricing

Instance ClassMemory LimitCPU LimitCost per hour per instance
F1 (default)256 MB600 MHz$0.05
F2512 MB1.2 GHz$0.1
F41024 MB2.4 GHz$0.2
F4_1G2048 MB2.4 GHz$0.3
B1256 MB600 MHz$0.05
B2 (default)512 MB1.2 GHz$0.1
B41024 MB2.4 GHz$0.2
B4_1G2048 MB2.4 GHz$0.3
B82048 MB4.8 GHz$0.4
Standard Environment Pricing Table

Apart from this, there are charges for network resources in Standard Environment, here for outgoing network traffic charges are $0.12per GiB and the incoming network traffic is free.

On the other hand, we have a flexible environment where you can deploy your application in the virtual machine types that you specify. These VM resources are billed on a per-second basis with a 1-minute minimum usage cost.

ResourceUnitUnit cost
vCPUper core hour$0.0526
Memory$0.0071$0.0071
Flexible Environment Pricing Table

Google Cloud App Engine – Cost Optimization Strategies

As of now, we understand how App Engine gets billed, let’s understand some of the best practices to optimize the spending:

  1. Reduce the number of Instances: We need to reduce the number of instances if it’s more than the required and specify the minimum number of instances required you can start with only 1 instance to check the need of your application and later you can increase it gradually as per requirement. To specify the maximum number of instances, use the max_instances setting in the app’s app.yaml file.
  2. Use small Instance class: Once you analyze the number of instances (CPU+Memory) required for your application, try to analyze the best-suited instance class for your application may help you to reduce the cost. Because the random selection of instances may increase the cost without letting you know. If it’s just a personal or test project you may use f1-micro basic instance class with enough resources for prototypes.
  3. Spin Down Dev Instances: If you are working on a prototype or in a local environment there might be the chance that you don’t need the instances running 24/7. By default, it will deploy a new version every time. This makes rolling back to an old version and A/B testing very easy but is not needed for local development. When you are done working for the day, you can spin down the instance with the following command to save cost, gcloud app versions stop dev and you can start it back up just as easily, gcloud app versions start dev.
  4. Clean up unused resources: You can delete deployments and services that are not in use anymore or just created for testing purposes. You may use Cloud Functions to automatically disable your app when your costs exceed a threshold you specify.
app engine, reduce app engine cost, manage app engine cost

Conclusion

Considering these for managing App Engine in your application will definitely help you to save money. The best long-term strategy is to establish a finops practice within your company. Economize is committed to the idea of making your cloud spending simpler and noise-free to help engineering teams like yours understand and optimize it. Get started today with a personalized demo for your organization.

Related Articles