Skip to content

Instantly share code, notes, and snippets.

@thoolihan
Created June 27, 2019 17:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thoolihan/ad0d7d8365fbab3926a935a9d8be334b to your computer and use it in GitHub Desktop.
Save thoolihan/ad0d7d8365fbab3926a935a9d8be334b to your computer and use it in GitHub Desktop.
Terraform ML machine
provider "aws" {
region = "us-east-1"
profile = "${var.aws_profile}"
shared_credentials_file = "~/.aws/credentials"
}
resource "aws_instance" "mlbox" {
ami = "ami-00ffbd996ef2211e3"
instance_type = "p2.xlarge"
key_name = "${var.keyname}"
vpc_security_group_ids = ["${var.backend_sg}"]
subnet_id = "${var.backend_sn}"
tags = {
Name = "${var.project}GPU"
Terraform = "true"
Project = "${var.project}"
}
}
resource "aws_eip" "default" {
instance = "${aws_instance.mlbox.id}"
vpc = true
tags = {
Name = "${var.project}EIP"
Terraform = "true"
Project = "${var.project}"
}
}
variable "aws_profile" {
description = "The AWS profile to use from the credentials file"
default = "personal"
}
variable "backend_sg" {
description = "The security group to use"
default = "sg-0debce85f677f6b87"
}
variable "backend_sn" {
description = "The subnet to use"
default = "subnet-01bd898cf21b27a64"
}
variable "keyname" {
description = "The keypair to use"
default = "tim-user"
}
variable "project" {
description = "Project name to tag with"
default = "DeepLearning"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment