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.
Google 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.
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.
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
|Cost per hour per instance
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.
|per core hour
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:
- 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_instancessetting in the app’s
- 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-microbasic instance class with enough resources for prototypes.
- 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 devand you can start it back up just as easily,
gcloud app versions start dev.
- 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.
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.