Created
June 7, 2018 15:17
-
-
Save Gunisalvo/8806ab0d8c34e709af551946aa79d224 to your computer and use it in GitHub Desktop.
UoL: Cloud Computing week 2
This file contains 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
provider "aws" { | |
region = "us-east-2" | |
} | |
resource "aws_security_group" "uol_security" { | |
name = "CKIT523-Group-[REPLACE WITH YOUR NAME]" #fixme! | |
description = "Uol Security" | |
ingress { | |
from_port = 22 | |
to_port = 22 | |
protocol = "TCP" | |
cidr_blocks = ["0.0.0.0/0"] | |
} | |
} | |
data "aws_ami" "ubuntu" { | |
most_recent = true | |
filter { | |
name = "name" | |
values = ["ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-*"] | |
} | |
filter { | |
name = "virtualization-type" | |
values = ["hvm"] | |
} | |
owners = ["099720109477"] # Canonical | |
} | |
resource "aws_instance" "uol_ec2" { | |
ami = "${data.aws_ami.ubuntu.id}" | |
instance_type = "t2.medium" # As described on the assignment | |
key_name = "CKIT523Key-[REPLACE WITH YOUR NAME]" #fixme! | |
security_groups = [ | |
"${aws_security_group.uol_security.name}" | |
] | |
tags { | |
Name = "CKIT523-[REPLACE WITH YOUR NAME]" #fixme! | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment