Hosting » Google Cloud » How do I deploy a static website to Google Cloud?

How do I deploy a static website to Google Cloud?

Last updated on December 18, 2022 @ 4:53 pm

Deploying a static website to Google Cloud can be done in a few simple steps. First, create a project in the Google Cloud Platform Console. Next, create a Cloud Storage bucket and add the files for your website.

Finally, create a Cloud Files volume for the website and upload the files. You can then configure the website to use CloudFront for distribution. Here are the steps:

1. In the Google Cloud Platform Console, create a project.

2. In the project’s Overview page, select Storage and click Create Storage Bucket.

3. In the Create Storage Bucket page, give your storage bucket a name and select Cloud Storage from the Type drop-down list.

4. In the Select a File System page, select Cloud Storage and click Create.

5. In the Create Cloud Storage Bucket page, select the Cloud Storage bucket you created in step 2 and click Create Filesystem.

6. In the Cloud Files Volume Creation page, give your Cloud Files volume a name and select Cloud Files from the Type drop-down list.

7. In the Add Files to Cloud Files Volume page, select the files you want to upload to your Cloud Files volume and click Upload.

8. In the Configure Cloud Files Volume page, give your Cloud Files volume a configuration and click Create.

9. In the Cloud Files Volume configuration page, select the Cloud Files volume you created in step 7 and click Set Up Distribution.

10. In the Set Up Cloud Files Distribution page, give your Cloud Files volume a distribution and click Create.

11. In the Cloud Files Distribution page, select the Cloud Files volume you created in step 10 and click Edit Settings.

12. In the Cloud Files Settings page, give your Cloud Files volume a distribution name and click Save.

13. In the Cloud Files Distribution page, select the Cloud Files volume you created in step 10 and click View Details.

14. In the Cloud Files Distribution page, under the Distribution Settings section, under the Accessible URL field, enter the URL for your website.

15. In the Cloud Files Distribution page, under the Delivery Method field, select CloudFront and click Save.

16. In the Cloud Files Distribution page, under the Settings section, under the Cache Prefetch field, enter a value (in milliseconds) and click Save.

17. In the Cloud Files Distribution page, under the Settings section, under the Cache Expiration field, enter a value (in seconds) and click Save.

18. In the Cloud Files Distribution page, under the Settings section, under the Cache TTL field, enter a value (in seconds) and click Save.

19. In the Cloud Files Distribution page, under the Settings section, under the Access Logging field, select Enable Access Logging and click Save.

20. In the Cloud Files Distribution page, under the Settings section, under the Log Level field, select Debug and click Save.

21. In the Cloud Files Distribution page, under the Settings section, under the Log Path field, enter a value (such as ./logs/) and click Save.

22. In the Cloud Files Distribution page, under the Settings section, under the Log Level field, select Info and click Save.

23. In the Cloud Files Distribution page, under the Settings section, under the Trace Level field, select Trace and click Save.

24. In the Cloud Files Distribution page, under the Settings section, under the Trace Path field, enter a value (such as ./trace/) and click Save.

PRO TIP: When deploying a static website to Google Cloud, be sure to follow the instructions carefully. If you do not, you may end up with a website that is not properly configured and may not work correctly.
Dale Leydon

Dale Leydon

Sysadmin turned Javascript developer. Owner of 20+ apps graveyard, and a couple of successful ones.