In our last chapter of google cloud computing platform quick start we learned how to quickly setup the google platform and get started with our first instance inside the cloud.
There are multiple ways to interact with google platform:
Lets work on the compute engine via the shell and try to create a new instance using shell.
Console Access
$ gcloud compute instances create instance2 (Created a new instance via command line)
I selected my zone and the new instance is booted.
REST API
Lets see how to see our instances in compute engine via the REST API
https://console.cloud.google.com/apis/api/compute-component.googleapis.com/overview
Click on API Explorer.
Enter project name and zone and accept OAuth authorization.
You will get the 200 Response, make sure you enable the API key from console > API manager > Credentials > Create credentials for API key> Generate.
Google Cloud SDK
Its a good time to install the google command line tools.
Download for your platform, mine is windows so I have downloaded Windows binary.
General Knowledge about GCP
Google Platform has two main parts:
An app will be deployed to app engine via the flow.
Google offers two different kind of run time environments.
Google also offers cloud endpoints to generate REST API for your code via the annotations for both Java and Python.
===========================================
Sample Hello World Code Deployment
Lets start deploying a sample application to understand it better.
We will be deploying the python application on the app engine.Also you will need to use the Google’s source repository to make changes to your code.
Lets use the browser shell to create a repository on google cloud and clone it locally for our hello world app.
Getting the Repository ready
By default you will have a repository with the name of default, create one with name of helloworld from the google console.
Lets create a folder by name of helloworld nd clone the helloworld project repository into that.
$mkdir helloworld
$cd helloworld
$gcloud source repos clone helloworld
$cd helloworld
$git pull https://github.com/GoogleCloudPlatform/getting-started-python
$ git push origin master
Now you should see the source code of getting started in your repository window.
Now its time to fulfill the app requirements and deploy to cloud.
We will use PIP to fulfill the FLASK requirements of Python 3 and deploy it to cloud.
$ pip install -r requirements.txt -t lib
$ gcloud app deploy
So your first hello world app is launched on google cloud engine, in this tutorial we learnt, how to setup the GIT shell to be used with google source repository and how we pushed our first python- hello world app, to the google cloud.
Keep Reading !
Action Item: Subscribe & Share !
No comments:
Post a Comment