This lesson is designed to teach you how to deploy an application to Google App Engine. You will learn how to deploy a new app, how to create multiple versions of an app, and how to split your user traffic between multiple app versions.
Learning Objectives
- Deploy an application to App Engine
- Create multiple versions of an application
- Split App Engine traffic between multiple versions
Intended Audience
- Cloud Architects
- System Administrators
- GCP Developers
- Anyone preparing for a Google Cloud certification
Prerequisites
- Access to a GCP account
Google App Engine allows you to build and deploy applications on a completely managed platform. It allows you to scale applications seamlessly, without having to deal with underlying infrastructure. App Engine automatically scales, depending on traffic, and it only consumes resources when your code is running. This means that you only need to pay for the resources that you consume.
In this demonstration, I'm going to show you how to deploy a basic web application to Google App Engine.
To do this I need to create a new project on Google Cloud platform. To create a new project, I need to go to the Google Cloud platform console, and then go up here and click New Project.
I need to provide a name for my project and I need to note it's project ID. For this demonstration, I'm going to call my project "GAE Demo Site". And I'm going to assign it a project ID of GAE Demo Site 007.
I'll just click the Create button here to create my project.
And then I'll go into my project here. Now each cloud platform project can contain one App Engine Application. So what I'm going to do here is prepare an app for our project. What I have on my desktop is a sample PHP app that I'm going to publish.
If we look at it here, we could see that the website folder contains our website content. Now, the app file, or the app.yaml file here, this is the application configuration file for our app that we're going to publish. This file tells App Engine how to map the URLs to our static files in our website. So let me close this, and go back to desktop here.
So, now that we have our project created and we have our sample app files in hand, we can publish our PHP web app to our App Engine.
Now to do this, we need to launch Google Cloud Shell. With Google Cloud Shell opened we'll need to launch the code editor, and then drag and drop our My App folder into the left pane. So let's minimize this. Launch our Cloud Shell here. And I'll expand this a little bit. And then what we'll do is we'll launch our editor here. So let's minimize my template demo here, and let's go ahead and drag my app into my editor. So now we can see my app is now up in my explorer.
What we need to do now is select our project that we created earlier. Now you can see here, the Google Cloud Platform project in this session is already set to GAE Demo Site 007, but what I want to do is show you the command that you would use to set your project if you had to. What you do is you run a G Cloud config command here, and we'll just type it out here. And then we do a set project. And then we'll call it GAE demo site 007. It essentially tells us it updated the property for the core project. So with our project set, we can now switch over to our My App directory by typing the CD My App command. This switches us over to the directory that we uploaded into our explorer. We could deploy our app from this directory, by running the G Cloud App deploy from our prompt. So what we'll do here is do g cloud app deploy. And what this is going to do is upload our app to App Engine. Now as you can see here we're being prompted to choose a region where we want our app to be located. I'm just going to choose option thirteen here for US East one.
Now what this is doing is creating the App Engine application in our project in the US East region. Now at this point, it's going to ask me if I'm sure or if I want to continue, and of course we do. So we'll hit Y and Enter. And at this point, it begins the deployment. We can see that the file uploads are completed, and now it's updating the service. Now this is a pretty basic application, so you can see that the process is already complete. Now since this upload is done and the process is completed, I can test my application by browsing to GAE Demo Site 007 dot app spot dot com. So I'm going to copy this from offscreen here because I don't feel like typing it out. And what we'll do is we'll open incognito here.
And then we can see here that our application is now live. So by leveraging App Engine, I can focus on my app code, rather than infrastructure, and this essentially is the whole point of the App Engine service.
Tom is a 25+ year veteran of the IT industry, having worked in environments as large as 40k seats and as small as 50 seats. Throughout the course of a long an interesting career, he has built an in-depth skillset that spans numerous IT disciplines. Tom has designed and architected small, large, and global IT solutions.
In addition to the Cloud Platform and Infrastructure MCSE certification, Tom also carries several other Microsoft certifications. His ability to see things from a strategic perspective allows Tom to architect solutions that closely align with business needs.
In his spare time, Tom enjoys camping, fishing, and playing poker.