Modernizing your Google App Engine applications

Posted by Wesley Chun, Developer Advocate, Google Cloud

Modernizing your Google App Engine applications header

Next generation service

Since its initial launch in 2008 as the first product from Google Cloud, Google App Engine, our fully-managed serverless app-hosting platform, has been used by many developers worldwide. Since then, the product team has continued to innovate on the platform: introducing new services, extending quotas, supporting new languages, and adding a Flexible environment to support more runtimes, including the ability to serve containerized applications.

With many original App Engine services maturing to become their own standalone Cloud products along with users’ desire for a more open cloud, the next generation App Engine launched in 2018 without those bundled proprietary services, but coupled with desired language support such as Python 3 and PHP 7 as well as introducing Node.js 8. As a result, users have more options, and their apps are more portable.

With the sunset of Python 2, Java 8, PHP 5, and Go 1.11, by their respective communities, Google Cloud has assured users by expressing continued long-term support of these legacy runtimes, including maintaining the Python 2 runtime. So while there is no requirement for users to migrate, developers themselves are expressing interest in updating their applications to the latest language releases.

Google Cloud has created a set of migration guides for users modernizing from Python 2 to 3, Java 8 to 11, PHP 5 to 7, and Go 1.11 to 1.12+ as well as a summary of what is available in both first and second generation runtimes. However, moving from bundled to unbundled services may not be intuitive to developers, so today we’re introducing additional resources to help users in this endeavor: App Engine “migration modules” with hands-on “codelab” tutorials and code examples, starting with Python.

Migration modules

Each module represents a single modernization technique. Some are strongly recommended, others less so, and, at the other end of the spectrum, some are quite optional. We will guide you as far as which ones are more important. Similarly, there’s no real order of modules to look at since it depends on which bundled services your apps use. Yes, some modules must be completed before others, but again, you’ll be guided as far as “what’s next.”

More specifically, modules focus on the code changes that need to be implemented, not changes in new programming language releases as those are not within the domain of Google products. The purpose of these modules is to help reduce the friction developers may encounter when adapting their apps for the next-generation platform.

Central to the migration modules are the codelabs: free, online, self-paced, hands-on tutorials. The purpose of Google codelabs is to teach developers one new skill while giving them hands-on experience, and there are codelabs just for Google Cloud users. The migration codelabs are no exception, teaching developers one specific migration technique.

Developers following the tutorials will make the appropriate updates on a sample app, giving them the “muscle memory” needed to do the same (or similar) with their applications. Each codelab begins with an initial baseline app (“START”), leads users through the necessary steps, then concludes with an ending code repo (“FINISH”) they can compare against their completed effort. Here are some of the initial modules being announced today:

  • Web framework migration from webapp2 to Flask
  • Updating from App Engine ndb to Google Cloud NDB client libraries for Datastore access
  • Upgrading from the Google Cloud NDB to Cloud Datastore client libraries
  • Moving from App Engine taskqueue to Google Cloud Tasks
  • Containerizing App Engine applications to execute on Cloud Run

Examples

What should you expect from the migration codelabs? Let’s preview a pair, starting with the web framework: below is the main driver for a simple webapp2-based “guestbook” app registering website visits as Datastore entities:

class MainHandler(webapp2.RequestHandler):
'main application (GET) handler'
def get(self):
store_visit(self.request.remote_addr, self.request.user_agent)
visits = fetch_visits(LIMIT)
tmpl = os.path.join(os.path.dirname(__file__), 'index.html')
self.response.out.write(template.render(tmpl, {'visits': visits}))

A “visit” consists of a request’s IP address and user agent. After visit registration, the app queries for the latest LIMIT visits to display to the end-user via the app’s HTML template. The tutorial leads developers a migration to Flask, a web framework with broader support in the Python community. An Flask equivalent app will use decorated functions rather than webapp2‘s object model:

@app.route('/')
def root():
'main application (GET) handler'
store_visit(request.remote_addr, request.user_agent)
visits = fetch_visits(LIMIT)
return render_template('index.html', visits=visits)

The framework codelab walks users through this and other required code changes in its sample app. Since Flask is more broadly used, this makes your apps more portable.

The second example pertains to Datastore access. Whether you’re using App Engine’s ndb or the Cloud NDB client libraries, the code to query the Datastore for the most recent limit visits may look like this:

def fetch_visits(limit):
'get most recent visits'
query = Visit.query()
visits = query.order(-Visit.timestamp).fetch(limit)
return (v.to_dict() for v in visits)

If you decide to switch to the Cloud Datastore client library, that code would be converted to:

def fetch_visits(limit):
'get most recent visits'
query = DS_CLIENT.query(kind='Visit')
query.order = ['-timestamp']
return query.fetch(limit=limit)

The query styles are similar but different. While the sample apps are just that, samples, giving you this kind of hands-on experience is useful when planning your own application upgrades. The goal of the migration modules is to help you separate moving to the next-generation service and making programming language updates so as to avoid doing both sets of changes simultaneously.

As mentioned above, some migrations are more optional than others. For example, moving away from the App Engine bundled ndb library to Cloud NDB is strongly recommended, but because Cloud NDB is available for both Python 2 and 3, it’s not necessary for users to migrate further to Cloud Datastore nor Cloud Firestore unless they have specific reasons to do so. Moving to unbundled services is the primary step to giving users more flexibility, choices, and ultimately, makes their apps more portable.

Next steps

For those who are interested in modernizing their apps, a complete table describing each module and links to corresponding codelabs and expected START and FINISH code samples can be found in the migration module repository. We are also working on video content based on these migration modules as well as producing similar content for Java, so stay tuned.

In addition to the migration modules, our team has also setup a separate repo to support community-sourced migration samples. We hope you find all these resources helpful in your quest to modernize your App Engine apps!

Announcing new training for building data lakes on AWS

We are pleased to announce the launch of Building Data Lakes on AWS. Data lakes enable organizations to generate business value by identifying and acting upon opportunities for business growth. This new one-day classroom course will help you practice building a data lake in a hands-on environment.  An expert instructor will teach you how to build and secure a data lake using AWS Lake Formation while also showing you how to optimize for cost and performance.

AWS Data Exchange providers can now copy product metadata from their existing products to a new product

AWS Data Exchange now enables providers to copy descriptions, data sets, and public offers from their existing products to a new product. With this launch, providers can select any existing product, published or unpublished, and copy all of its details to a new draft product, which they can then modify as needed and publish within a few seconds. For providers that frequently create new products that share similar metadata, this will save a significant amount of time and effort.

Rising demand and engagement for productivity apps on Amazon Fire Tablets

Over the last several years, as boundaries between home and work have started to overlap significantly, we’ve seen our customers lean into productivity apps on their Amazon Fire tablets. These apps allow users to manage their home life with apps like notes, calendars and task management. They also enable customers to get work done faster and collaborate across teams. During the course of 2020, this has led to a 62% increase in productivity app users month over month across the tablet appstore, and a 226% growth in app engagement amongst productivity customers in the last year. We anticipate this trend to continue beyond 2020 – customers have forever changed the way they get things done and stay productive.

As a developer, it is worth considering how your app can fit into this productivity shift and how it can make an impact on customers. Here are some insights about the type of apps we are seeing resonate with Fire tablet users: 

Personal productivity apps on Fire tablets
Fire tablets are used every day around the world, with an increasing amount of customers using their devices not just for entertainment and gaming, but also for productivity content. Our customers are increasingly using their tablets for personal productivity and managing their life at home.

Customers are actively searching for apps that can help create a to-do list, jot down a note as a reminder, or answer a quick email, without having to open their laptop. With over 10,000 personal productivity apps in the Appstore, we’re seeing first-hand how they are empowering users to be more productive when they are short on time and juggle many different responsibilities.

Enabling work related productivity
Work related productivity apps like Email, Video, Spreadsheets, and Documents that can help customers do their job at home have become especially popular throughout the last year. With customers looking to get work done faster, and more efficiently, developers around the world have invested in creating apps that meet these needs. In the Amazon Appstore, we have seen a 135% increase in work-related apps submitted in 2020.

Tablet apps encourage collaboration and creativity
In the virtual world we now live in, sparking collaboration and thinking creatively can often be a challenge. On Fire tablets, apps related to brainstorming, drawing, collaboration, and conversation increased in usage with customers by 30% in the last year. The same is true for video and collaboration tools related to education and at-home learning; demand for those apps has risen by over 25% since the beginning of 2020.
 

If you’re a productivity developer and new to developing for Amazon devices, it’s easy to publish apps on the Amazon Appstore and make them available for Fire tablet. Our Fire tablets run on Amazon’s Fire OS 7 (based on Android 9 Pie). You can easily test compatibility of your Android app in a matter of minutes using our App Testing Service – learn more here. Create an Amazon Developer account to get started today. 

Already have an app on Amazon Appstore and want to update your apps to ensure compatibility with the latest model of Fire tablets? Check out the following resources:

 

Interested in receiving productivity related updates from the Amazon Appstore? Click here.

New AWS Solutions Consulting Offer – AMI Factory

AMI Factory is an AWS Solutions Consulting Offer delivered via a consulting engagement from Capgemini, an AWS Migration Competency Partner. AMI Factory helps customers integrate and build any type of AMIs with custom configurations, setting security standards for operating system (OS)-level benchmarks and vulnerability scans based on customer requirements within a few hours. Customers that request this consulting offer will participate in an engagement that delivers identification of eligible AMIs, template creation, and deployment.

Amazon ElastiCache for Redis admite a partir de ahora clústeres de alta disponibilidad en AWS Local Zones

Amazon ElastiCache for Redis ahora admite la ejecución de clústeres con alta disponibilidad en diferentes AWS Local Zones. Las AWS Local Zones son una extensión de una región de AWS donde puede ejecutar sus aplicaciones sensibles a la latencia mediante servicios de AWS geográficamente próximos a los usuarios finales. Antes, Amazon ElastiCache for Redis solo admitía el lanzamiento de un clúster en una única AWS Local Zone.

AWS announces General Availability of Amazon GameLift Queue notifications

Today, we are excited to announce the general availability (GA) of Queue notifications for Amazon GameLift. Trusted by some of the most successful game companies in the world like Wargaming, Ubisoft, and more, GameLift deploys, operates, and scales dedicated servers for multiplayer games. With this new update, you as a game developer can now receive automatic notifications when changes take place to the state of your player queues on GameLift.

AWS Security Hub se integra con Amazon Macie para incorporar automáticamente los hallazgos de datos confidenciales para mejorar la administración centralizada de la postura de seguridad

AWS Security Hub ahora se integra con Amazon Macie para incorporar automáticamente los hallazgos de datos confidenciales de Macie. Security Hub ya incorporaba los hallazgos de políticas de Macie, pero mediante esta integración se suman los hallazgos de datos confidenciales. Todos los hallazgos de Security Hub se normalizan automáticamente mediante el formato de AWS Security Finding (ASFF), lo que permite buscarlos, establecer correlaciones y utilizarlos con mayor facilidad. Para comenzar, visite la página de Configuración en la consola de Macie y seleccione Security Hub como destino de publicación para los hallazgos de datos confidenciales. También puede obtener más información en la documentación de Macie sobre cómo detectar datos confidenciales.

AWS Config adds pagination support for advanced queries that contain aggregate functions

AWS Config advanced queries feature now supports pagination for queries that contain aggregate functions, such as COUNT and SUM. For example, getting the total number of resources in each AWS account requires the COUNT aggregate function. You can now use advanced queries to get complete results for your aggregate queries through pagination, which were previously limited to 500 rows. Pagination is a technique that is used to divide large results into “pages,” where each page contains a subset of results. You can process the first page of results, then the second page, and so on.

New AWS Solutions Consulting Offer – Pipeline Factory

Pipeline Factory is an AWS Solutions Consulting Offer delivered via a consulting engagement from Mphasis Stelligent, an AWS DevOps Competency Partner. Pipeline Factory enables DevOps teams to define, build, and publish standardized pipelines that enforce quality, security, and governance throughout the software delivery lifecycle. Customers that request this consulting offer will participate in an engagement that delivers discovery and design, Pipeline Factory implementation, and publication and deployment of standardized Pipeline Products.