Created
October 31, 2018 14:57
-
-
Save dice89/daed4c48f972db649d2b7efd8795d156 to your computer and use it in GitHub Desktop.
Create GPU enable Instance with Terraform
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "google_compute_instance" "gpu-vm" { | |
count = 1 | |
name = "gpu-vm" | |
machine_type = "n1-standard-4" // 1 CPU 16 Gig of RAM | |
zone = "${var.region}" // Call it from variable "region" | |
tags = ["http"] | |
boot_disk { | |
initialize_params { | |
image = "ubuntu-os-cloud/ubuntu-1604-lts" | |
size = 50 // 50 GB Storage | |
} | |
} | |
network_interface { | |
network = "default" | |
access_config { | |
// Ephemeral IP - leaving this block empty will generate a new external IP and assign it to the machine | |
} | |
} | |
guest_accelerator{ | |
type = "nvidia-tesla-k80" // Type of GPU attahced | |
count = 1 // Num of GPU attached | |
} | |
scheduling{ | |
on_host_maintenance = "TERMINATE" // Need to terminate GPU on maintenance | |
} | |
metadata_startup_script = "${file("start-up-script.sh")}" // Here we will add the env setup | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment