Google App Engine Standard and Flex in same project - google-app-engine

I am new to App Engine Flex and know a little on App Engine Standard. I want to use both in the same project so that I can use the App Engine Standard for receiving emails and the flex environment for cron jobs / backend jobs using Python3. Is it possible to use both App Engine Standard and App Engine Flex in the same project or does it has to be different?
Thank you in advance!

Yes. Quote from the Google App Engine doc (emphasis added):
You can run your applications in App Engine using the flexible
environment or standard environment. You can also choose to
simultaneously use both environments for your application and allow
your services to take advantage of each environment's individual
benefits.

Related

Cloud Datastore Client Library vs App Engine SDK on App Engine Go Standard

When writing a Go App Engine Standard app, it used to be the case that you had to use the App Engine SDK to access the data store. However, these days (since Go 1.11?), it seems to work if you just use the Cloud Datastore Client Library.
Is there a downside of using the Cloud Datastore Client Library on App Engine Standard for accessing the datastore? (apart from a bit of extra configuration to make the dev appserver use the emulator). The advantage is that it enables code reuse for other environments.
App Engine Standard for Go1.11 runs on the new, second generation (beta) runtime which doesn't have the limitations of the 1st generation and is capable of running any framework, library, or binary. On the other hand, App Engine no longer modifies the Go toolchain to include the appengine package and it is strongly recommended to use the Google Cloud client library or third party libraries instead of the App Engine-specific APIs.
For more details about this, I recommend to have a look at the doc here about the differences between both generations and how to handle them.

Google Cloud Datastore on App Engine with Java. Which package to use?

Newbie to Datastore. I found two tutorials on the GCP site to use Datastore on App Engine. Which one should I use?
There are subtle differences in how the APIs work.
https://cloud.google.com/datastore/docs/datastore-api-tutorial
uses package (import com.google.appengine.api.datastore.Entity;)
vs.
https://cloud.google.com/appengine/docs/standard/java/building-app/cloud-datastore
uses package (import com.google.cloud.datastore.Entity)
Question: Is there a preferred package to use and call the datastore API while on App Engine - com.google.cloud.datastore.Entity vs. com.google.appengine.api.datastore.Entity?
The library with this package com.google.appengine.api.datastore (aka "Datastore API for Java") is intended for use by Java 7 and Java 8 applications which run on AppEngine.
The library with this package com.google.cloud.datastore (aka "Cloud Datastore client library") is intended for use by any Java 8 application regardless of where it is deployed (GKE, GCE, on-premises etc)
From the docs:
Datastore API for Java is a low-level Datastore API built into the App Engine SDK to provide direct access to all Datastore features and is described throughout the App Engine Datastore documentation for Java.
Cloud Datastore client library is a library that can be used by apps in the App Engine standard Java 8 runtime, by applications in the App Engine flexible environment, and by non App Engine applications as well.
So, according to Google, both are valid choices subject to these limitations ...
If you are running Java 7 then you cannot use Cloud Datastore client library
If your application is not deployed to AppEngine then you cannot use Datastore API for Java
These limitations describe the scenarios in which one or other of these libraries cannot be used. Google offers no advice on which one should be used. This is because the two libraries are functionally equivalent so, assuming that the limitations described above do not apply to your usage, the choice is probably moot.

Is it possible to use the appengine/datastore package on the GAE flex environment?

There are two different datastore packages for Google App Engine:
google.golang.org/appengine/datastore and cloud.google.com/go/datastore.
The documentation for the appengine/datastore package uses the standard environment while the documentation for the cloud package uses the flex environment.
I have a Go application which uses the appengine/datastore package on the standard GAE environment. If I want to migrate this application from the standard environment to the flex environment do I need to switch to the cloud.google.com/go/datastore package, or can I continue using the appengine/datastore package? If not, why not?
You need to migrate to cloud.google.com/go/datastore.
From Migrating Services from the Standard Environment to the Flexible Environment:
The App Engine flexible environment does not provide the API libraries
present in the App Engine SDK. If you decide to migrate your
application from the App Engine standard environment to the flexible
environment, you must update your code to use services and APIs
that are available across all Google Cloud Platform environments.
And from Cloud Datastore:
You can access Google Cloud Datastore from anywhere using the
Cloud Datastore API. Use the Google Cloud client libraries to
store and retrieve data from Cloud Datastore.
The same Cloud Datastore data is available regardless of if you use
the App Engine libraries, the Google Cloud client libraries, or call
the API directly.
At this time ORM libraries that available in the standard environment
such as ndb and Objectify are not supported outside of the
standard environment.
For more information, see the following guide:
Using Cloud Datastore

Google App Engine standard environment to Cloud-SQL Second Generation instance

I consider starting a PHP project in App Engine and would like to use Cloud 2SQL in the second generation.
Now I am confused if this is possible or not, since I have found different information on the google sites.
https://cloud.google.com/appengine/docs/php/cloud-sql/
Note: Access to Google Cloud SQL Second Generation instances can be granted only for apps running in the flexible environment. Learn more.
https://cloud.google.com/sql/docs/dev-access
App Engine standard environment to a Second Generation instance
You connect from Google App Engine standard environment) to Second Generation instances by completing the following steps:
Granting the application access (if required)
Updating your application to provide the appropriate connection string.
Is it now possible or not?
It is possible to use Cloud SQL v2 on App Engine standard.
Check out Terrance Ryan's (Developer Advocate for GCP) blog post on this topic [0], more specifically:
"If you are an App Engine customer and looked at v2 before, it did not support App Engine. However, that appears to have changed: you can now access Cloud SQL v2 from App Engine standard environment, or App Engine flexible environment."
[0] http://terrenceryan.com/blog/index.php/cloud-sql-v1-vs-v2/

Why App Engine running Rails app spins up Compute Engine instances?

I am running Rails on the App Engine. My question is why Google is running the Compute Engine. I just want to run the App Engine. Google starts the App Engine and the Compute Engine when I deploy.
App Engine provides two environments - standard "sandboxed" environment and Managed VMs. Currently the standard environment supports only Java, Python, PHP and Go. If you want to use something else, you have to go with Managed VMs. In fact, Managed VMs are Google Compute Engine virtual machines.
You can find more details here.

Resources