Hosting a static website is a very simple solution. But for some of you who are not familiar with cloud, this will be a good practice to experience cloud.
Cloud Storage is a object storage for companies of all sizes. Store any amount of data. Retrieve it as often as you’d like. We always store media like video, image, video and log files on it. Also we can set a lifecycle to delete some expired objects automatically. This service is very widely used on different solution.
The solution for static web site is extremely simple. What we have to do is just put all the required files on Cloud Storage and allow access to others.
Create a Bucket
In case you are very new to GCP, here we will not use the command line to put our files on Cloud Storage, we just have to click on console.
We firstly search for Storage on menu.
Click create bucket.
What we have to do is just give the unique name for the bucket and click create.
Click upload files. If you do not have existing web site, please paste the following code and name it as .html extention.
<!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <h1>This is a Heading</h1> <p>This is a paragraph.</p> </body> </html>
We can simply drag it and right bottom corner will show complete.
Then move to permissions and click ADD.
If you want to show it to everyone, please select allUsers on member, and choose Storage Object Viewer role. Then click save. In case you want to limit someone, then you have to input the email address on member.
Confirm allow public access.
Back to object, we can copy the URL now. And try it on new browser tab.
Cool, we have done.
But you may find that the URL is using storage.googleapis.com, if you have your own domain, you could point the domain to cloud storage.
Google Cloud also provide DNS service called cloud DNS.
To delete the bucket, we just back to the main page of Cloud Storage, select the bucket and click DELETE.
Input the bucket name then confirm it.
All the things gone. You will not have any charge.