How to Host a Website on Google Cloud Platform using Firebase 🌤️

Roshan SharmaRoshan Sharma
3 min read

Hosting a website on the cloud is a cost-effective and scalable solution for businesses and individuals alike. Google Cloud Platform (GCP) and Firebase are two popular platforms that offer a range of services for hosting and building web applications.

In this article, we will guide you through the process of hosting a website on GCP using Firebase, a serverless platform for building web and mobile applications. By the end of this article, you will have a fully-functional website hosted on the Google Cloud.

Prerequisites:

  • A Google account. If you don’t have one, you can create one for free.

  • A basic understanding of Firebase and GCP.

Step 1: Set up Firebase

  • Go to the Firebase website (https://firebase.google.com/) and sign in with your Google account.

  • Click on the “Get Started” button and select “Create a project”.

  • Give your project a name, select your country, and click on the “Create Project” button.

Step 2: Deploy your website

  • Go to the Firebase Hosting section and click on the “Get started” button.

  • Follow the instructions to set up a new site. You will need to install the Firebase CLI (Command Line Interface) on your computer. The instructions for doing so are provided on the Firebase website.

  • Once you have installed the CLI, open a terminal window and navigate to the root directory of your website.

  • Run the following command: “firebase init”. This will initialize a Firebase project in your current directory.

  • When prompted, select the Firebase Hosting option and then choose the project you created earlier.

  • Follow the instructions to configure your website. You will be asked to specify the public directory, which is the directory that contains your website files.

  • Once the configuration is complete, run the following command to deploy your website: “firebase deploy”. This will upload your website files to Firebase and make them available to the public.

Step 3: Connect your website to GCP

  • Go to the Google Cloud Console (https://console.cloud.google.com/).

  • Click on the “Select a project” drop-down menu and select the project you created earlier.

  • Go to the Firebase Hosting section and click on the “Connect to GCP” button.

  • Follow the instructions to connect your Firebase project to GCP. This will give you access to additional services and resources on GCP.

Step 4: Verify your website

  • Go to the Firebase Hosting section and click on the “Visit Website” button.

  • Your website should now be live and accessible to the public.

Congratulations! You have successfully hosted your website on Google Cloud using Firebase. Firebase provides a serverless platform for building and hosting web applications, making it a great choice for developers who want to focus on building their applications without having to worry about managing servers.

GCP provides a range of additional services and resources for building and hosting web applications, making it a powerful platform for hosting your website. With the help of this guide in the form of an article, you should be able to get your website up and running in Google Cloud in no time.

If you have any questions or need additional help, feel free to reach out to the comments section & follow for more! 😇

2
Subscribe to my newsletter

Read articles from Roshan Sharma directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Roshan Sharma
Roshan Sharma

Hi, I'm Roshan 👋 🎓 I am a second-year student at Rajiv Gandhi Institute of Petroleum Technology, currently undertaking my Bachelor's in Information Technology. I am a Cloud Computing Enthusiast, who loves to work on Platforms like GCP, AWS & Microsoft Azure. Previously, I have been an Intern at Flipkart, an apprentice at the Google Cloud Ready Facilitator program, and currently doing Open Souce and Competitive Programming. ⚡ I'm an Aspiring Software engineer with experience in Web engineering, DevOps, Python, and cloud engineering. My experience revolves around building websites and applications on Cloud, DevOps, training Models, Python libraries, and cloud infrastructure with a particular interest in AI and ML. ✨ I am a Google Crowdsource Contributor @Crowdsource by Google, and I work with communities. I have made multiple contributions and love to talk about various topics and technologies, mostly around Cloud Computing, Amazon Web Services, and Google Cloud Platform. 👨‍💻 I'm also a Hackathon Enthusiast and regularly participate in Hackathon. In the past, I have participated in"HacktoberFest 2022" organized by GitHub, Digital Ocean, and Docker. Apart from that I also participate in various hackathons organized by GFG, Scalar & Devfolio. ✍️ Beside Development and Programming, I have an unadulterated love for technical writing. I love to write across a wide spectrum of technical topics. I have written articles on Compute Science fundamental concepts, GSOC, MLSA, and many more on @Medium. ▶️ Reach out to my Technical Articles at: https://medium.com/@roshanearth