Google App Engine is a powerful platform that lets you build and run applications on Google’s infrastructure — whether you need to build a multi-tiered web application from scratch or host a static website. Here's a step-by-step guide to hosting your website on Google App Engine.
Creating a Google Cloud Platform project
To use Google's tools for your own site or app, you need to create a new project on Google Cloud Platform. This requires having a Google account.
- Go to the App Engine dashboard on the Google Cloud Platform Console and press the Create button.
- Enter a name for the project, edit your project ID and note it down. For this tutorial, the following values are used:
- Project name: GAE Sample Site
- Project ID: gaesamplesite
- If you've not created a project before, you'll need to select whether you want to receive email updates or not, agree to the Terms of Service, and then you should be able to click the Create button to create your project.
Creating an application
Each Cloud Platform project can contain one App Engine application. Let's prepare an app for our project.
- We'll need a sample application to publish. If you've not got one to use, download and unzip this sample app.
- Have a look at the sample application's structure — the
website
folder contains your website content andapp.yaml
is your application configuration file.- Your website must go inside the
website
folder, and its landing page must be calledindex.html
, but apart from that it can take whatever form you like. - The
app.yaml
file is a configuration file that tells App Engine how to map URLs to your static files. You don't need to edit it.
- Your website must go inside the
Publishing your application
Now that we've got our project made and sample app files collected together, let's publish our app.
- Click the Activate Google Cloud Shell button at the top of the console window.
- Open the code editor from the Cloud Shell toolbar.
- Drag and drop the
sample-app
folder into the left pane of the code editor. - Get back to Cloud Shell and enter the following command to go to your app's directory:
cd sample-app
- You are now ready to deploy your application, i.e. upload your app to App Engine:
gcloud app deploy
- Enter a number from one to seven to choose the region where you want your application located.
- Enter
Y
to confirm. - Now navigate your browser to your-project-id.appspot.com to see your website online. For example, for the project ID gaesamplesite, go to gaesamplesite.appspot.com.
See also
To learn more, see Google App Engine Documentation.