---
title: "Deploying the vNIOS Instance from the Marketplace CLI for Terraform"
canonical: "https://docs.infoblox.com/space/vniosgcp/1458536797/Deploying%20the%20vNIOS%20Instance%20from%20the%20Marketplace%20CLI%20for%20Terraform"
format: markdown
---
After you click the **Launch** button on the *Product details* page, use the **Command-Line Deployment** to deploy the vNIOS instance using the CLI commands.

In this method of deployment you will download the Terraform code to obtain the Terraform configuration file that contains configuration necessary to deploy the vNIOS instance.

1. On the *New Infoblox NIOS BYOL deployment* page > **Command-Line Deployment** tab, complete the following:
  1. **Configure a service account (Optional)**:  
Click the **Configure** button and either select an existing service account or create a new one. For the role permissions that the account must be assigned, see *[Prerequisites for Deploying vNIOS for Google Cloud Instances](https://infoblox-docs.atlassian.net/wiki/spaces/vniosgcp/pages/35786159)*.
  2. **Configure gcloud**: Configure the gcloud environment for Google Cloud to interact with the Terraform code. Your project and login details are automatically populated as `gcloud` commands. Modify them if required.  
Example:  
`gcloud config set project <project_name>`  
`gcloud auth application-default login`
  3. **Review VM images**: The NIOS solution you selected is displayed here. Review it.
2. Scroll down and click the **Download** button to download the Terraform code.  
Use the downloaded Terraform module to deploy the vNIOS instance through the CLI.
3. When the prompt to save the file appears, select the path to save the compressed file and click **Save**.
4. Extract the compressed file and configure the variables.tf as follows:
  1. Specify the network in the `networks` block as shown in the following example:   
`variable "networks" {`  
`  description = "The network name to attach the VM instance."`  
`  description = "The network names to attach to each VM interface."`  
`  type        = list(string)`  
`  default     = ["vnet1", "vnet2"]`
    `}`
  2. Specify the subnetwork in the `sub_networks` block as shown in the following example:  
`variable "sub_networks" {`  
`  description = "The sub network name to attach the VM instance."`  
`  type        = list(string)`  
`  default     = []`  
`}`
5. In the main.tf file, you can set rules to allow data traffic through the following ports at the instance level:  
Note that this configuration can be defined only by using the Terraform’s CLI method for deployment.  
`##this will open ports for the firewall using network tag `  
`resource "google_compute_firewall" "allow_ports" {`  
`    for_each = {`  
`    "tcp-22"    = { protocol = "tcp", port = "22" }`  
`    "udp-53"    = { protocol = "udp", port = "53" }`  
`    "tcp-443"   = { protocol = "tcp", port = "443" }`  
`    "udp-1194"  = { protocol = "udp", port = "1194" }`  
`    "udp-2114"  = { protocol = "udp", port = "2114" }`  
`    "tcp-8787"  = { protocol = "tcp", port = "8787" }`  
`  }`
  1. Define the cloud-init settings as shown in the following example:  
`Variable “metadata” {`  
`  description = “(Optional) Metadata key/value pairs to make available from within the VM instance.”`  
`  type        = (string)`  
`  default     = {`  
`      user-data = “temp_license: nios IB-B926 enterprise dns dhcp cloud\ndefault_admin_password: infoblox”`  
`      google-logging-enable = “0”`  
`      google-monitoring-enable = “0”`  
`  }`  
`}`  
For more information about user-data settings, see <u>*[cloud-init Configuration in vNIOS for Google Cloud](https://infoblox-docs.atlassian.net/wiki/spaces/vniosgcp/pages/1930264593)*</u>.
6. To run the code, run the following Terraform commands in the same sequence:
  1. `terraform init`
  2. `terraform plan`
  3. `terraform apply`  
This deploys the instance.

## Connecting to the Serial Console of the Instance

After the deployment of the instance completes, you can establish a serial connection with NIOS by connecting to the serial console through which you can to install licenses and troubleshoot issues.

1. Navigate to the *Compute Engine* panel > **Virtual machines** > **Virtual instances**.
2. Click to open the deployed instance.
3. Click **SSH**.