Qwik Start - Python App Engine
Review
App Engine allows developers to focus on what they do best: writing code. App Engine's standard environment is built on container instances running on Google's infrastructure, with containers preconfigured with different runtimes (Java 7, Java 8, Python 2.7, Go, PHP, etc.). Each runtime includes libraries that support the App Engine standard API. For many applications, the standard environment runtime and libraries are sufficient.
With App Engine's standard environment, you can build and deploy applications that run reliably with large amounts of data and under heavy load. App Engine's standard environment includes the following features:
Persistent storage that can be queried, indexed, and transacted
Automatic scaling and load balancing
Synchronous task queues to execute tasks outside the scope of the application
Scheduled tasks to trigger events at specified times or intervals
Integration with other Google Cloud services and APIs
Applications run in a secure sandbox environment. This app allows Engine's standard environment to distribute requests among multiple servers, allowing servers to scale to meet traffic demand. Your applications run in a uniquely secure and reliable environment, regardless of server hardware, operating system, or physical location.
This hands-on lab will show you how to create a simple App Engine application that displays a simple message.
Material
Download the application
Check out the application
Customise your application
Setting
Before clicking the Start Lab button
Please read the instructions here. Lab time is recorded and cannot be stopped. The timer that appears when you click Start Lab indicates when Google Cloud resources are available.
This Qwiklabs Practice Lab allows you to practise lab activities yourself using a simulated or demo environment instead of a real cloud environment. As a result, you will be provided with a new temporary login to log in and access Google Cloud while performing the lab.
Necessary things
To complete this lab you will need:
A standard Internet browser (Chrome recommended)
Enough time to complete the lab
Note: Even if you already have personal Google Cloud accounts and projects, please do not use them in the lab.
Note: If you are using a Chrome OS device, open an incognito window to run this lab.
Google Cloud Console: How to start sign a lab
Select "Start Lab" from the menu. If you must pay, the lab, please select your payment method in the pop-up that appears. The Lab Details panel on the left shows:
Open the Google Console button
Time remaining
The temporary login you must use for this lab
Any other information needed to complete this experiment (if any)
Click Open Google Console. The resource will launch in the lab and display the login page in a separate tab.
Tip: Open each tab in a separate window and place them side by side.
Note: Activate the Start Lab button. If payment is required,t.
The username can be copied from the Lab Details screen and pasted into the login dialogue. Select next.
Paste the password into the Welcome dialogue box after copying it from the Lab Details screen. Select next.
Important: Use the credentials shown in the left panel. Do not use your Google Cloud Skills Boost credentials.
Note:It can cost more money to use your own Google Cloud account for this lab.
Then proceed as follows:
Please agree to the terms of use.
This is a temporary account, so don't use recovery options or two-factor authentication.
Don't sign up for the free trial.
Then the Cloud Console will open in this tab.
Note: Clicking on the navigation menu in the top left will bring up a menu with a list of Google Cloud products and services.
Activate Google Cloud Shell
Google Cloud Shell is a virtual machine packed with developer tools. It comes with a 5 GB persistent home directory and runs on Google Cloud. Google Cloud Shell provides command line access to GCP resources.
Click the Enable Cloud Shell button in the top right toolbar of the GCP console.
Continue to click.
Provisioning and connecting to the environment will take some time. When I connect, I'm already authenticated and the project is set to PROJECT_ID. for example:
gcloudi is a Google Cloud Platform command-line utility. This pre-installed application supports tab completion and is included with Cloud Shell.
You can list the correct account names with the following command:
The output is:
You can list your project ID with the following command:
Output:
Example output:
Allow the Admin API for Google App Engine.
The App Engine Administration API allows developers to provision and manage App Engine applications.
In the left menu, click APIs & Services > Libraries.
Type "App Engine Admin API" in the search box.
Click App Engine Admin API.
Click on Activate. If there is no prompt to enable the API, the API is already enabled and no action is required.
Get the Hello World app now.
A simple Hello World app for Python is provided. You can use it to quickly test your app on the Google Cloud platform. Follow these steps to download Hello World to your Google Cloud instance.
To clone the Hello World sample app repository to your Google Cloud instance, type the following command.
Go to the folder with the sample code.
Check the application
dev appserver.py The pre-installed App Engine SDK comes with the Google Cloud Development Server (), which you may use to test your application on.
Start your Google Cloud Development Server by entering the command below from the helloworld directory, which contains the app.yaml configuration file for your application:
The development server will start and listen for requests on port 8080.
Click Web Preview > Port Preview: 8080 to see the results.
You should see something like this in a new browser window:
Update the code
While you work on your application, the development server can remain operational. The development server reloads the files as necessary while keeping an eye out for changes in the source files.
Let's carry it out. Main.py keep the development server running Open a new command line window and type "Hello, World" in it. "Hello, ruthless world!"
To launch a fresh command line session, click + next to the Cloud Shell tab.
Enter the following command to navigate to the directory containing the sample code.
Enter the following command to open main.py in Nano and edit its contents.
Change the "Hello, world!" To "Hello, cruel world!" Exit and save the file.
Reload your browser with Hello World! Or click Web Preview > Preview on Port: 8080 to see the results.
Customize your app
Deploy the application to App Engine by running the following command from the root directory of the created application (where the app.yaml file is stored):
You will be asked to enter the location where you want the application tool to reside.
Enter a number representing the area. An App Engine application is created.
Example output:
Enter Y when asked to confirm details and start configuring the service.
Example output:
Note: If you get "Failed to load P4SA" error when deploying the app, run the above command again.
Show apps
To launch the browser, type the following command and then click on the given link.
Example output (note that the original link is different):
Your application has been downloaded and you can read the short message in your browser.
Click Check Progress to make sure you're on track with your goal.
Check your understanding
Take our quiz to test your knowledge of Google Cloud Platform (select all that apply).
Are container instances running on Google's infrastructure pre-configured among the many available runtimes?
Php
java7
Python 2.7
all
Go
java8
Thank you for your hard work
Get the quest done
Next, continue your exploration with the baseline: development and development. A quest is a series of labs that form a learning path, which, upon completion, is awarded with a badge above in recognition of your achievements. Badges can be made public and linked to your online resume and social media accounts. After completing this lab, sign up for this quest and get your credit immediately. Check out other Qwiklabs quests available.
Go to the next lab
This lab is also part of a series of labs called "Qwik Start" where you can experience many of the features Google Cloud has to offer. Search Qwik Get Started in the Laboratory Directory to find a lab that interests you.
Information and more Next steps
For more information about App Engine, see App Engine Overview.
Try Flask with App Engine standard environment to discover other ways to use App Engine.
Google Cloud Certification and Training
Get the most out of your Google Cloud technology. This class will give you the technical skills and best practices you need to keep learning. Training ranges from beginner to advanced, with on-demand, in-person and virtual options to fit your busy schedule. Earning a certificate validates your skills and knowledge of Google Cloud technology.
Last Updated: March 16, 2022
Last day of testing in the lab: March 16, 2022
Copyright 2020 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names are trademarks or registered trademarks of their respective companies.
Comments
Post a Comment