forked from rp4fx12/hello-world-example
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.tf
31 lines (28 loc) · 845 Bytes
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
provider "aws" {
region = "us-east-1"
}
resource "aws_instance" "example" {
ami = "ami-a4c7edb2"
instance_type = "t2.micro"
key_name = "HelloWorld"
vpc_security_group_ids = ["sg-41189330"]
iam_instance_profile = "EC2Access"
user_data = <<-EOF
#!bin/bash
sudo yum update –y
sudo yum install git -y
mkdir /app
chmod 755 /app
cd /app
git clone https://github.com/alexvayn/hello-world-example.git
curl -sL https://rpm.nodesource.com/setup_6.x | sudo -E bash -
sudo yum install nodejs --enablerepo=nodesource -y
node --version > nodeVersion.txt
cd /app/hello-world
npm install
npm start
EOF
tags {
Name = "Alex's Weak EC2"
}
}