Creating a VM
Creating and uploading an SSH key
If you don't already have an SSH key, you will need to create one on your local machine. We recommend following GitHub's "Generating a new SSH key" documentation.
When creating a VM for the first time, you will be prompted to upload an SSH key, which the VM will use to authenticate future SSH attempts. It will be saved into your account with the name "Default" and accessible on subsequent VM creations from the UI. You can manage all SSH keys in the Console's Security page.
Crusoe Cloud supports all SSH public key formats that are accepted by OpenSSH. These include:
- [email protected]
- ecdsa-sha2-nistp256
- ecdsa-sha2-nistp384
- ecdsa-sha2-nistp521
- [email protected]
- ssh-ed25519
- ssh-dss
- ssh-rsa
For more information on the authorized key format please see the OpenSSH docs.
Creating a new VM
- CLI
- UI
- Terraform
Use the compute vms create
command to create a VM of your choice. As an example, you can create a VM that uses a single Nvidia A40 GPU:
crusoe compute vms create \
--name my-vm \
--type a40.1x \
--location us-northcentral1-a \
--image ubuntu22.04:latest \
--keyfile ~/.ssh/id_ed25519.pub
You can find possible values for type and location by running crusoe compute vms types
and crusoe locations list
respectively.
If you don't specify an image, the VM will default to the latest version of ubuntu 22.04. Run crusoe compute images list
for more options.
In order to create a VM via the Crusoe Cloud console:
- Visit the Crusoe Cloud console
- Click the "Compute" tab in the left nav
- Click the "Instances" tab on the top bar
- Click the "Create Instance" button
- Input all required information, including instance type, location, name, etc.
- Click the "Create Instance" button
Creating and accessing VMs is the first step to getting started on Crusoe Cloud. The following is intended to help get you started using Terraform to provision a VM in Crusoe Cloud.
Copy and paste the code below in a text-editor of your choice and name the file main.tf
. The example below creates a VM that uses a single Nvidia A40 GPU called “my-vm”:
// Crusoe Provider
terraform {
required_providers {
crusoe = {
source = "registry.terraform.io/crusoecloud/crusoe"
}
}
}
// local files
locals {
ssh_key = file("~/.ssh/id_ed25519.pub") # replace with path to your public SSH key if different
}
// new VM
resource "crusoe_compute_instance" "my_vm" {
name = "my-vm"
type = "a40.1x"
location = "us-northcentral1-a"
image = "ubuntu22.04:latest" # use the 'latest' flag to get the most up-to-date image available from Crusoe
ssh_key = local.ssh_key
}
name
, type
, location
and ssh_key
are required arguments. default_project
is also required, but is typically specified in the config file, which is why it's omitted in the crusoe_compute_instance
resource (see step 4 above). image
is not required and for this example, we will use an ubuntu22.04:latest
image.
After saving the code to a main.tf
file, the following commands serve as the process to create a resource in Crusoe Cloud using Terraform:
terraform init
- Initializes a working directory containing Terraform configuration files.
terraform plan
- the output of this command will show the resources Terraform plans on creating.
terraform apply
- this command will create the resources.
You can confirm that terraform successfully created the resources through the console, or via the CLI with crusoe compute vms list
.
Access the VM via SSH
If VM creation succeeds, the VM will start and you will be provided with an IP address for you to SSH into:
ssh ubuntu@<ip> # or root@<ip> (deprecated)
Note: It may take several minutes for the VM to start, and you may get Connection Refused
errors until the VM starts. If you get an error immediately after creating or starting a VM, wait a minute or two and try again.
If VM creation fails or you are otherwise unable to access a running VM, ensure that you have billing enabled and that you have installed and configured the CLI properly. If it still isnt working, please contact support.
For more details on VMs, see the Compute section.