Search code examples
google-app-engineapp-engine-flexible

How do you run both Flexible Environment and Standard Environment in the same Google App Engine project?


This answer, https://stackoverflow.com/a/46656486/2016196, suggests that you can run both Flexible Environment and Standard Environment. This page, https://cloud.google.com/appengine/docs/the-appengine-environments, says "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."

I assume that means you can run both types of environments in the same project. Am I wrong to assume that? I would like to keep everything that's of the same project in the same project and it makes sense that they would be suggesting that you don't need to create an entirely different project to use both environments, but I can't find any instructions on how to do that. I checked the app.yaml reference, https://cloud.google.com/appengine/docs/standard/python/config/appref, and I didn't see anything that suggests you can state the environment you'd like to use, making them different for different services. I also don't see anything in the Google Cloud Console for App Engine that suggests creating a new service with a different environment.

So, is there a way to use both types of environments, i.e. flexible and standard, in the same project? Or does it require one to create an entirely new project to add another type of environment.

The reason for this is most of my services work with standard environment but I would like to use websockets for a couple things, which would require me to use the flexible environment.


Solution

  • You can indeed have some Services that use Standard environment and others that use Flexible environment within the same project.

    When you deploy your an app to App Engine, by default, it's deployed to the default service. You can then deploy other services by specifying the service property in the app.yaml file. If left blank, the service will be deployed to the default App Engine service. You can find more info about the service porperty here

    You can also set the environment you want your service to run at specifying the env porperty in the app.yaml (eg: env: flex)

    More info about App Engine Services can be found in the docs here and here