# Compute Engine

#### To check for the defaults

```
gcloud compute project-info describe --project <your_project_ID>
```

#### To set defaults

```
gcloud config set compute/zone ...
```

```
gcloud config set compute/region ...
```

#### To create your VM through command-line, run the following command:

```
gcloud compute instances create gcelab2 \
--machine-type n1-standard-2 \
--zone $ZONE
```

**Command details**

* `gcloud compute` allows you to manage your Compute Engine resources in a format that's simpler than the Compute Engine API.
* `instances create` creates a new instance.
* `gcelab2` is the name of the VM.
* The `--machine-type` flag specifies the machine type as *n1-standard-2*.
* The `--zone` flag specifies where the VM is created.
* If you omit the `--zone` flag, the `gcloud` tool can infer your desired zone based on your default properties. Other required instance settings, such as `machine type` and `image`, are set to default values if not specified in the `create` command.

#### To SSH through command line

```
gcloud compute ssh gcelab2 --zone us-central1-c
```

Make sure to add your zone, or omit the `--zone` flag if you've set the option globally.

#### To list your instances

```
gcloud compute instances list
```
