Skip to content

Instantly share code, notes, and snippets.

@anvodev
Last active January 12, 2020 08:41
Show Gist options
  • Save anvodev/2ff0b469d2aa01ed6ee7ad9aae33a2fc to your computer and use it in GitHub Desktop.
Save anvodev/2ff0b469d2aa01ed6ee7ad9aae33a2fc to your computer and use it in GitHub Desktop.
provider "aws" {
region = "ap-southeast-1"
}
resource "aws_security_group" "instance" {
name = "poc-instance"
ingress {
from_port = 8080
to_port = 8080
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
}
resource "aws_instance" "poc" {
ami = "ami-0123b531fc646552f"
instance_type = "t2.micro"
vpc_security_group_ids = [aws_security_group.instance.id]
user_data = <<-EOF
#!/bin/bash
echo "Hello, World!" > index.html
nohup busybox httpd -f -p 8080 &
EOF
tags = {
Name = "poc"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment