Recently, SADA Systems surveyed about 200 IT managers about their use of public cloud services and they found that 84 percent of IT managers are using public cloud infrastructure, as opposed to the corporate data center. According to Tony Safoian-- president and CEO at SADA Systems--All signs point to the adoption of public cloud is growing and enterprise IT is becoming more comfortable with the prospect of running their crucial and sensitive data on public cloud infrastructure”.
Now, Cisco is also forecasting that by the year 2020, cloud traffic will represent 92% of all the data center network traffic. As per the Google Trends (shown below), interest surrounding Google Cloud Platform itself has been on an exponential rise over the past two years.
Nowadays, more and more firms are migrating as in most cases it provides the most flexible, secure, and cost-effective solution. It saves money as well as time on IT staffing and allows for the most rapid scaling of any online solution or platform.
Ref: Google Trends
Google Cloud Hosting is just one of the many web development services provided by the Google Cloud Platform. In addition to this, they offer their storage solutions, DNS, App Engine, CDN, and a plethora of other products. Google Cloud Platform comprises physical servers in addition to virtual resources like virtual machines that are comprised of Google’s data centers around the globe.
There are many companies that use Google Cloud Platform’s multi-regional deployment mode which means that you can choose a different data center for each of your WP websites.
There are thousands of reputed companies using the Google cloud platform. Some notable companies using Google Cloud Platform (App Engine or Compute Engine) include HSBC, Home Depot, Spotify, HTC, Best Buy, Snapchat, Coca Cola, Domino’s, Philips, Feedly, Sony Music, ShareThis, and Ubisoft.
Moreover, Apple has also been seen moving some of its services away from Amazon Web Services, spending between $400 million & $600 million on the Google Cloud Platform; although this could not be independently confirmed.
Now let’s look at some of the top benefits of using Google Cloud Hosting and why we think it is the best solution in the market as it relates to pricing, stability, performance, scalability, backups, and security.
Let’s talk about how to host web applications on the Google cloud platform. In order to host a web app, first, it is required to configure a cloud storage bucket. And, after that, we upload and share the website’s files. Ultimately, we test the web app.
A CNAME record is a type of DNS record. It directs traffic that requests a URL from your domain to the resources that you want to serve. For a domain like www.xyz.com, the CNAME record contains the information below:
If you want to connect your domain to the cloud storage:
1. Create a CNAME record that points to c.storage.googleapis.com. And your domain registration should have a proper path to administer your domain including adding a CNAME record.
For instance, if you add a CNAME record pointing www.xyz.com to c.storage.googleapis.com, then you will require creating a bucket with the name of www.xyz.com
CONSOLE
To create a bucket:
If it is successful, it will take you to the bucket’s page where you see the text that ‘there are no objects in this bucket’.
GSUTIL
Use gsutil mb command:
Gsutil mb gs: //www.xyz.com
If successful, the command returns:
Creating gs: //www.xyz.com/
CODE SAMPLES
C++
C#
GO
JAVA
NODE.JS
PHP
PYTHON
RUBY
REST APIS
JSON API
XML API
In order to add to your bucket the files you want your website to serve:
CONSOLE
Once the upload finishes, you should see the file name along with the file information shown in the bucket.
GSUTIL
You can use the gsutil CP command to copy files to your bucket. For instance, to copy the file index.html from its present location
Desktop:
Gsutil cp Desktop/index.html gs: //www.xyz.com
If successful, then the command returns:
CODE SAMPLES
C++
C#
GO
JAVA
NODE.JS
PHP
PYTHON
RUBY
REST APIS
JSON API
curl -X POST --data-binary @index.html \
-H "Content-Type: text/html" \
-H "Authorization: Bearer ya29.AHES6ZRVmB7fkLtd1XTmq6mo0S1wqZZi3-Lh_s-6Uw7p8vtgSwg" \
Link
XML API
Either you can make all the files in your bucket publicly accessible or you can set individual objects to be accessible through your website. Usually, creating all the files in your bucket accessible is easier and faster.
If you select to control the accessibility of individual files, you can set the default object ACL for your bucket so that all the files uploaded to your bucket are shared by default.
You can also assign an index page suffix which is controlled by the MainPageSuffix property and a custom error page, which is controlled by the NotFoundPage property. Assigning either is optional, but without an index page, nothing is served when users access your top-level site. For instance, http://www.xyz.com
Index pages
The index page (also known as a web server directory index) is a file served to visitors when they request a URL that does not have an associated file. When you assign a MainPageSuffix, cloud storage looks for a file with that name whose prefix matches the URL the visitor requested.
For instance, let’s suppose that you set the MainPageSuffix of your static website to index.html. Additionally, suppose you have no file named directory in your bucket www.xyz.com. In this case, if a user requests the URL http://www.xyz.com/directory, Cloud storage attempts to serve the file www.xyz.com/directory/index.html. If that file does not exist, Cloud storage returns an error page.
The MainPageSuffix also controls the file served when users request the top-level website. Continuing the above instance, if a user requests http:// www.xyz.com, cloud storage attempts to serve the file www.xyz.com/index.html.
Error Page
The error page is the file returned to visitors of your static website who request a Universal Resource Locator(URL) that does not correspond to an existing file. If you have assigned a MainPageSuffix, cloud storage only returns the error page if there is neither a file with the requested name nor an applicable index page.
When returning the error page, the http response code is 404. The property that controls which file acts the error page is NotFoundPage, users receive a generic error page.
Setting MainPageSuffix and NotFoundPage
In the below-mentioned sample, the MainPageSuffx is set to index.html and NotFoundPage is set to 404.html:
CONSOLE
GSUTIL
Use the gsutil web set command to set the MainPageSuffix property with the -mflag and the NotFoundPage with the -e flag:
gsutil web set -m index.html -e 404.html gs://
www.xyz.com
If successful, the command returns:
Setting the website config on gs://www.xyz.com/...
Testing the website
Now, verify the content is served from the bucket by requesting the domain name in a browser. You can do this using a path to an object or with just the domain name if you set the MainPageSuffix property.
For instance, if you have an object named test.html stored in a bucket named www.xyz.com, check that it’s accessible by going to www.xyz.com/test.html in your browser.
After reading this blog, you will get the knowledge on how to create a website using google cloud. If you still any confusion, you can hire web developers who can help in configuring your site to Google cloud. By opting for the right web development solution, you can have a secure, scalable and feature-packed Google cloud-based website.