This page is for developers using the flexible environment
with the setting
vm:true in their
want to upgrade to the latest release, which requires changes in your app
This page does not apply to upgrading from the App Engine standard environment, which is covered in Migrating Services from the Standard Environment to the Flexible Environment.
Beta shutdown schedule
You must upgrade your apps before the beta-related services are shut down according to the follow schedule:
- Important dates
Beta deprecation date: November 15th, 2016
On November 15th, 2016, all deployments to App Engine using the beta
vm:trueconfiguration were deprecated.
General availability date: March 10th, 2017
The App Engine flexible environment (
env:flex) was released for general availability on March 10th, 2017.
Beta decommission date: December 15th, 2017
On December 15th, 2017, the Managed VMs environment (
vm:true) will be shut down and all apps using the beta
vm:trueconfiguration will stop receiving traffic.
- Beta deprecation date: November 15th, 2016
Upgrading to the flexible environment
To upgrade to the flexible environment:
- Replace your
appengine-web.xmlfile with the
app.yamlconfiguration file, following the tabs provided under Converting from
app.yaml. Make sure it contains the following settings:
runtime: java env: flex
- Review the breaking changes list to
determine whether any additional changes are required in your
If you are using a runtime compatible with the App Engine standard APIs, such as
java-compat, see also Continuing to use compat runtimes.
- During the upgrade, consider making changes to use new features.
- After making the necessary changes, deploy the new version of your app to App Engine.
If you use a compat runtime and are converting to a flexible runtime, you need
to replace your
appengine-web.xml configuration with
app.yaml. Use the
following tabs as a guide:
The following shows an
app.yaml file for a Java
flexible environment app:
runtime: java env: flex handlers: - url: /.* script: this field is required, but ignored runtime_config: # Optional jdk: openjdk8 server: jetty9 manual_scaling: instances: 1 beta_settings: enable_app_engine_apis: true
The following shows an
appengine-web.xml file for a Java
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0"> <threadsafe>true</threadsafe> <env>flex</env> <beta-settings> <setting name="enable_app_engine_apis" value="true"/> </beta-settings> </appengine-web-app>
Continuing to use compat runtimes
You must move from the
env:flex configuration file setting before
December 15, 2017. However, you can continue to use a runtime in the flexible
environment that is compatible with the App Engine standard APIs, such as
To run an application on a compat runtime using the
- Fill out this form.
After you receive a confirmation email, update your
app.yamlconfiguration file as follows:
Replace the deprecated
vm:trueentry with the
enable_app_engine_apis: trueunder the
beta_settings: enable_app_engine_apis: true
<beta-settings> <setting name="enable_app_engine_apis" value="true"/> </beta-settings>
- Replace the deprecated
- To keep your app running using a compat runtime, see the following sections.
Plan the rest of your app's upgrade or migration to
If you are using a compat runtime, you cannot use the Blobstore API in the flexible environment to serve blobs. As an alternative, use Cloud Storage. Use the Google Cloud client libraries to store and retrieve data in Cloud Storage.
For more information, see Using Cloud Storage.
If you are using a compat runtime, to keep existing handlers working with the Cron service, take the following steps:
security-constraintfrom the related handler in your
Update the handler to verify that requests originate from App Engine's cron
X-AppEngine-Cron. Verify that the request originates from IP address `0.1.0.1` as detailed in Securing URLs for cron.
If you are using a compat runtime, you can use the Mail API to send emails, but you cannot receive emails.
For more information on setting up your app to send email, see the following guides:
Task queues service
Although it is unsupported in the flexible environment, if you are approved to use a compat runtime, the App Engine Task Queue API is still available. To keep existing handlers working with the Task Queues service, take the following steps:
security-constraintfrom the related handler in your
Update the handler to verify that requests originate from App Engine's task
For alternatives to the Task Queue API, see Task queues.
The Deferred Tasks libraries are not available in the App Engine flexible environment.
If you are using a compat runtime and need to use deferred tasks instead of a worker service for Task Queues, complete the following steps:
- Create a separate queue and post to that queue.
- Use a custom key that specifies which code to execute when the task is delivered.
- Write a custom handler to process the request and dispatch the code.
Shared-core machine types
Shared-core machine types, which have less than 1 vCPU, are not supported in the
App Engine flexible environment. If you are using shared core machines, when you
env:flex, you must upgrade your machines to be at least one core.
Alternatively, you can move the app to the App Engine standard environment.
/_ah/warmup requests are not supported in the App Engine flexible environment.
For example, you can create a readiness check that returns a ready status after initializing the cache so your app won't receive traffic until it is ready.
Issues with large pages
If you encounter errors when serving large JSP subpages that are included
<jsp:include page="subpage.jsp">, update the code to
<%@ include file="subpage.jsp" %>.
If you are defining static files in the
The underlying resources behind flexible environment deployments (including Cloud Load Balancing, Compute Engine instances, and Managed Instance Groups) are hidden in Google Cloud Platform Console in order to provide a fuller abstraction of an App Engine application and its instances. Individual instances can be viewed and controlled in the GCP Console on the Instances page.
Instances can still be unlocked and reached via SSH for debugging purposes.
Instead of using the
gcloud compute instances command, use
instances. You can also initiate SSH connections from the
GCP Console Instances page.
Upgrading to the App Engine flexible environment requires a few
changes to your code and configuration files. This section includes deprecations
and breaking changes that you must address before deploying your app with
env: flex configuration.
The following libraries and their related services were deprecated on November 15th, 2016, and are not supported in the flexible environment:
Replace the deprecated configuration
vm:true in your
with the flexible environment setting
You must also update the
file to remove or replace the other configuration setting that have been
- Secure handlers
handlersis now deprecated for the App Engine flexible environment. If you need SSL redirection, you can update your application code and use the
X-Forwarded-Protoheader to redirect
httptraffic. You can also use the HTTP Strict Transport Security response header.
- Login handlers
handlersis now deprecated for the App Engine flexible environment. You should follow the guidance for User service migration.
Environment variable changes
The following environment variables have been removed or renamed. When available, the replacement environment variable has been listed:
|Deprecated environment variable||New environment variable (where applicable)|
Request header changes
The following HTTP request headers have changed:
Removed from all requests:
Now included with all requests:
The Memcache service is currently not available for the App Engine flexible environment. An alpha version of the memcache service will be available shortly. If you would like to be notified when the service is available, fill out this early access form.
If you need access to a memcache service immediately, you can use the third party memcache service from Redis Labs. To access this service, see Caching Application Data Using Redis Labs Memcache.
You can also use Redis Labs Redis Cloud, a third party fully-managed service. To access this service, see Caching Application Data Using Redis Labs Redis.
The Task Queue API has limited availability outside of the standard environment. If you want to use the service outside of the standard environment, you can sign up for the Cloud Tasks alpha.
In many cases where you might use pull queues, such as queuing tasks or messages that will be pulled and processed by separate works, Cloud Pub/Sub is a good alternative that offers similar functionality and delivery guarantees.
URL routing changes
You can no longer route traffic to specific instances for apps that are running in the flexible environment. For example, you cannot direct requests to instance instanceID:
New features to consider when upgrading
Take note of the following improvements that you can take advantage of when upgrading your app:
- Multi-zone deployments
- Deployments using the required
env: flexconfiguration are able to utilize autoscaled instances across multiple availability zones for their underlying Compute Engine virtual machines.
- Custom instance shapes
- You can choose a custom machine type when configuring machine resources for the App Engine flexible environment. Custom Machine Types allow you to select customized CPU, memory, and disk settings to match the needs of your application.
- Networking upgrades
- App Engine flexible environment includes a new networking stack based on Google Cloud Load Balancing, which has resulted in the following:
The App Engine flexible environment release introduces a new pricing
model. Customers who are currently using
vm:true will receive one year of raw
Compute Engine pricing. To view the new prices for the
flexible environment, see Costs for flexible environment
Tip: Spending limits are not supported in the flexible environment. You should consider creating budgets and setting alerts.