---
title: Creating a Virtual Machine with a Web Server in Google Cloud
description: Your step-by-step guide to creating web servers within virtual machines in Google Cloud.
image: https://blog.avenuecode.com/hubfs/DA%201.png
---

[AvenueCode.com](https://avenuecode.com) [News](https://avenuecode.com/news) [Contact](https://avenuecode.com/contact)

[![Avenue Code Snippets Logo](https://blog.avenuecode.com/hubfs/Avenue%20Code%20New%20Logos%20-%202023/AC-Snippets---Black.png)](https://blog.avenuecode.com/?hsLang=en-us) *menu*

- Technology
  
  [Cloud](https://blog.avenuecode.com/blog/topic/cloud?hsLang=en-us) [Delivery Infrastructure](https://blog.avenuecode.com/blog/topic/delivery-infrastructure?hsLang=en-us) [Web Experience](https://blog.avenuecode.com/blog/topic/web-experience?hsLang=en-us) [Agile Mindset](https://blog.avenuecode.com/blog/topic/agile-mindset?hsLang=en-us) [Quality First](https://blog.avenuecode.com/blog/topic/quality-first?hsLang=en-us)
  
  [Design](https://blog.avenuecode.com/blog/topic/design?hsLang=en-us) [Solution Architecture](https://blog.avenuecode.com/blog/topic/solution-architecture?hsLang=en-us) [Data & ML](https://blog.avenuecode.com/blog/topic/data-and-machine-learning?hsLang=en-us) [Mobile Experience](https://blog.avenuecode.com/blog/topic/mobile-experience?hsLang=en-us)
- [Whitepapers](https://blog.avenuecode.com/blog/topic/whitepapers?hsLang=en-us)
- [Spotlight](https://blog.avenuecode.com/blog/topic/spotlight?hsLang=en-us)
- [Extraordinary Women in Tech](https://blog.avenuecode.com/blog/topic/extraordinary-women-in-tech?hsLang=en-us)
- [Avenue Code Culture](https://blog.avenuecode.com/blog/topic/avenue-code-culture?hsLang=en-us)

- [Cloud](https://blog.avenuecode.com/blog/topic/cloud?hsLang=en-us)
- [Design](https://blog.avenuecode.com/blog/topic/design?hsLang=en-us)
- [Delivery Infrastructure](https://blog.avenuecode.com/blog/topic/delivery-infrastructure?hsLang=en-us)
- [Solution Architecture](https://blog.avenuecode.com/blog/topic/solution-architecture?hsLang=en-us)
- [Web Experience](https://blog.avenuecode.com/blog/topic/web-experience?hsLang=en-us)
- [Data & ML](https://blog.avenuecode.com/blog/topic/data-and-machine-learning?hsLang=en-us)
- [Agile Mindset](https://blog.avenuecode.com/blog/topic/agile-mindset?hsLang=en-us)
- [Mobile Experience](https://blog.avenuecode.com/blog/topic/mobile-experience?hsLang=en-us)
- [Quality First](https://blog.avenuecode.com/blog/topic/quality-first?hsLang=en-us)
- [Whitepapers](https://blog.avenuecode.com/blog/topic/whitepapers?hsLang=en-us)
- [Spotlight](https://blog.avenuecode.com/blog/topic/spotlight?hsLang=en-us)
- [Extraordinary Women in Tech](https://blog.avenuecode.com/blog/topic/extraordinary-women-in-tech?hsLang=en-us)
- [Avenue Code Culture](https://blog.avenuecode.com/blog/topic/avenue-code-culture?hsLang=en-us)

# [Creating a Virtual Machine with a Web Server in Google Cloud](https://blog.avenuecode.com/creating-a-virtual-machine-with-a-web-server-in-google-cloud)

- [Tweet](https://twitter.com/share)

*perm\_identity* [Douglas Augusto](https://blog.avenuecode.com/creating-a-virtual-machine-with-a-web-server-in-google-cloud/author/douglas-augusto?hsLang=en-us)

*schedule* 5/22/19 2:00 PM

Web servers are used to host websites and make them available to users through HTTP protocol requests. It is common for these web servers to be created within virtual machines in the cloud. In this post, we will provide a step-by-step guide on how to create a virtual machine and web server inside Google Cloud.

##### **Context**

[Google Compute Engine](https://cloud.google.com/compute/) delivers virtual machines running on Google's innovative data centers and global fiber networks.

Compute Engine resources are created in regions or zones. A region is a geographical location where you can run your resources. Each region has one or more zones. For example, the us-central1 region denotes the region in the central United States that has the zones us-central1-a, us-central1-b, us-central1-c, and us-central1-d. Resources that live in a zone are referred to as zonal resources.

![DA 1](https://blog.avenuecode.com/hs-fs/hubfs/DA%201.png?width=512&name=DA%201.png)

##### **Create a New Instance**

You can create a new virtual machine through the Cloud Console or the gcloud command line.

In the GCP Console, on the top left of the screen, select Navigation menu > Compute Engine > VM Instances:

![DA 2](https://blog.avenuecode.com/hs-fs/hubfs/DA%202.png?width=324&name=DA%202.png)

To create a new instance, click Create:

![DA 3](https://blog.avenuecode.com/hs-fs/hubfs/DA%203.png?width=512&name=DA%203.png)

To create a virtual machine, there are several parameters that must be filled. The main ones are: Name, Region, Zone, Machine Type, Boot Disk, and Firewall.

To create a virtual machine through the command line in gcloud, all the same parameters must be passed, as shown in the example below:

gcloud compute instances create \[name\] --machine-type \[machine-type\] --zone \[zone\]

##### **Installing the NGINX Web Server**

First, open an SSH client with the virtual machine. You can perform this operation directly from the list of virtual machines in the Cloud Console, as shown in the image below:

![DA 4](https://blog.avenuecode.com/hs-fs/hubfs/DA%204.png?width=512&name=DA%204.png)

After accessing the machine's SSH client, run the following commands:

sudo su -

// get root access

apt-get update

// update the OS

apt-get install nginx -y

// install NGINX

ps auwx | grep nginx

// check if NGINX is running

If everything is correct, you may access your web server simply by entering the external IP of the machine, as shown in the image below:

![DA 5](https://blog.avenuecode.com/hs-fs/hubfs/DA%205.png?width=512&name=DA%205.png)

When accessing the link, you will see the default page of your server:

![DA 6](https://blog.avenuecode.com/hs-fs/hubfs/DA%206.png?width=512&name=DA%206.png)

##### **Conclusion**

Creating virtual machines to run your own web server is an easy task and a quick process. Among the key benefits of Compute Engine is its ability to configure the virtual machine with custom resources since the platform is not limited to predefined virtual machine configurations.

---

### Author

# Douglas Augusto

 Douglas Augusto is a Lead Solutions Architect at Avenue Code and is passionate about Cloud Computing. He is a Google Developer Expert (GDE) for Google Cloud Platform and a Mentor in Cloud Computing at Google for Startups.

---

### Related Posts

### New Horizons for Solution Architects

[READ MORE](https://blog.avenuecode.com/new-horizons-for-solution-architects?hsLang=en-us)

### Terraform 101: An Introduction to Infrastructure as Code

[READ MORE](https://blog.avenuecode.com/terraform-101?hsLang=en-us)

### Which Google Cloud certification is the best fit for me?

[READ MORE](https://blog.avenuecode.com/google-cloud-certification?hsLang=en-us)

### How the Mulesoft JWT Validation Policy Works

[READ MORE](https://blog.avenuecode.com/mulesoft-jwt-validation-policy-works?hsLang=en-us)

### Leave a Comment!

### Avenue Code Social

[![Facebook Icon](https://blog.avenuecode.com/hubfs/Images/Blog/facebook.png?t=1486470796564)](https://www.facebook.com/avenuecode)

[![Twitter Icon](https://blog.avenuecode.com/hubfs/Images/Blog/twitter.png?t=1486470796842)](https://twitter.com/AvenueCode)

[![LinkedIn Icon](https://blog.avenuecode.com/hubfs/Images/Blog/linkedin.png?t=1486470796556)](https://www.linkedin.com/company/avenue-code)

### Newsletter

Want to stay on top of all tips and news from Avenue Code?

### Popular Snippets

![Primary Logo AvenueCode Inverted.png](https://blog.avenuecode.com/hs-fs/hubfs/Images/Logos/Primary%20Logo%20AvenueCode%20Inverted.png?width=1104&name=Primary%20Logo%20AvenueCode%20Inverted.png "Primary Logo AvenueCode Inverted.png")

### About Us

- [Who We Are](https://www.avenuecode.com/who-we-are)
- [What We Do](https://www.avenuecode.com/what-we-do)
- [Portfolio](https://www.avenuecode.com/portfolio)
- [Partners](https://www.avenuecode.com/partners)
- [News](https://www.avenuecode.com/news)
- [Events](https://www.avenuecode.com/events)
- [Blog](https://blog.avenuecode.com/)
- [Contact](https://www.avenuecode.com/contact)

### Our Offices

San Francisco

[+1 415 766 4178](tel:+553125161448) [ac.inquiries@avenuecode.com](mailto:brazil.info@avenuecode.com)

Belo Horizonte

[+55 31 2516 1448](tel:+553125161448) [brazil.info@avenuecode.com](mailto:brazil.info@avenuecode.com)

São Paulo

[+55 11 3205 3232](tel:+553125161448) [brazil.info@avenuecode.com](mailto:brazil.info@avenuecode.com)

### We're Hiring!

- [Belo Horizonte](https://www.avenuecode.com/who-we-are)
- [New York](https://www.avenuecode.com/what-we-do)
- [San Francisco](https://www.avenuecode.com/portfolio)
- [São Paulo](https://www.avenuecode.com/partners)

---

©2015 - 2017 Avenue Code

[![Facebook Icon](https://blog.avenuecode.com/hubfs/Images/Icons/facebook-2.png)](https://www.facebook.com/avenuecode) [![Twitter Icon](https://blog.avenuecode.com/hubfs/Images/Icons/twitter-2.png)](https://twitter.com/AvenueCode) [![LinkedIn Icon](https://blog.avenuecode.com/hubfs/Images/Icons/linkedin-2.png)](https://www.linkedin.com/company/avenue-code) [![Glassdoor Icon](https://blog.avenuecode.com/hubfs/Images/Icons/glassdoor-icon-1.png)](https://www.glassdoor.com/Overview/Working-at-Avenue-Code-EI_IE456173.11,22.htm) [![YouTube Icon](https://blog.avenuecode.com/hubfs/Images/Icons/youtube-2.png)](https://www.youtube.com/user/AvenueCodePlay)

Please enable JavaScript to view the [comments powered by Disqus.](http://disqus.com/?ref_noscript)

© 2026 Avenue Code

```json
{
  "@context" : "https://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Douglas Augusto",
    "url" : "https://blog.avenuecode.com/author/douglas-augusto"
  },
  "dateModified" : "2022-02-25T21:39:28.568Z",
  "datePublished" : "2019-05-22T17:00:00.000Z",
  "headline" : "Creating a Virtual Machine with a Web Server in Google Cloud",
  "image" : [ "https://blog.avenuecode.com/hubfs/DA%201.png" ],
  "mainEntityOfPage" : {
    "@id" : "https://blog.avenuecode.com/creating-a-virtual-machine-with-a-web-server-in-google-cloud",
    "@type" : "WebPage"
  },
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "url" : "https://blog.avenuecode.com/hubfs/Avenue%20Code%20New%20Logos%20-%202023/Avenue%20Code-primary%20versions_LOGO%20HORIZONTAL%20group%201-7.png"
    },
    "name" : "Avenue Code"
  }
}
```