In this article, I want to share my experience around Google Cloud Platform. You will find all details needed to jump start your development with Google app engine (GAE) & choosing an appengine environment with GAE. By end of this article, you should feel confident about the choice you made and i look forward to hear your stories.
![blog-cloud-platform cloud-platform](https://m9bf32.p3cdn1.secureserver.net/wp-content/uploads/2020/12/blog-cloud-platform.png)
Google Cloud
Pre-requisites :
1. Create a GCP Google Cloud Project by visiting GAE console. Make sure that billing is enabled for this project
2. Install google cloud sdk/tools. The famous gcloud utility should help you do anything and everything you need. Please refer this for more details and platform specific instructions in google.
3. Install eclipse cloud tools to run the application in local machine for Standard and Flexible environment.
Real question:
Google App Engine has two modes of choosing an environment : standard environment and flexible environment. Choice always creates a confusion. Let me share some highlights to make this easy.
![fruit-blog fruit-blog](https://dorustree.clockmonk.in/blog/google-app-engine-comparison-standard-vs-flexible-app-engine/fruit-blog.jpeg)
Designed by prostooleh / Freepik
Standard environment
Standard environment is a mode where Google Cloud has pre-defined instance classes like B1, B2…F4_1G. This is more of a managed VM where the appengine has pre-defined vm configurations and we will be charged based on the instance running hours.
Advantages:
1. Zero downscaling is possible.
2. Automatic security patches for managed VMs
3. Very sophisticated development environment which mimics the actual live environment setup for deployment. Can deploy to PROD even from Eclipse
4. Deployment happens within seconds
5. VM Instance comes up in seconds in case of auto scaling
Disadvantages:
1. One of the major drawbacks is there is no direct way to consume compute engine resources from AppEngine. For a normal developer, this is like not able to connect his REST service with a MySQL running on compute engine.
2. No SSH access. Yes. read it again. No SSH access to VMs from the standard environment. This means lesser flexibility in integration with third-party systems
3. No background process can be run. We can use the cron.yaml and queues/TaskWorker for any background manipulation as an alternative
4. With projects involving multi-threading and projects where performance is not a luxury, a standard environment can be a killer.
5. For each instance, there is an initial start-up cost of 15 minutes instance time. Google will also charge you for 15mins after the last thread has completed the execution. See this, search for 15mins.
6. Standard environment applications are single-homed, meaning that all instances of the application live in a single availability zone.
Flexible environment:
A flexible environment is a mode of usage with a google app engine where the virtual machines are managed by the team using the environment.
Runtime customization ( Java8, Go, Ruby, etc. any runtime that u need),
Infrastructure customization (Docker, SSH access, etc.) &
Performance ( guaranteed with choice of power-packed VMs suiting your needs)
Unlike standard environments, clients will be charged based on resource usage. Please see this.
Advantages:
1. SSH access and support for docker. This is a key difference that opens a lot of possibilities.
2. Access to computing engine resources as the VMs will be handled by the compute engines to efficiently execute client requests.
3. Instances are health-checked, healed as necessary, and co-located with other services within the project.
4. Critical, backward compatible updates are automatically applied to the underlying operating system.
5. Support for background threads and found to be very scalable when used even with multi-threaded architecture
Disadvantages:
1. Instance startup time in minutes rather than seconds when compared to standard environment
2. Deployment time in minutes rather than seconds when compared to standard environment
3. NO ACCESS to following services : App Engine APIs & Services such as NDB, Users API, Memcache, Images API and others.
Verdict:
Go for app engine standard environment when you want fewer customizations (runtime, VM instances, security, etc. ) and want to plug and play with Google App Engine
Go for AppEngine flexible environment when you want to use compute engine resources extensively and deploy third party docker components/frameworks within your infrastructure
Google recommends a hybrid approach and you can migrate parts of standard application into flexible.