PIP=<새로 만들어진 EC2 Public IP> PIP=13.124.123.216 while true; do curl --connect-timeout 1 http://$PIP:80/ ; echo "------------------------------"; date; sleep 1; done cat < main.tf provider "aws" { region = "ap-northeast-2" } resource "aws_instance" "example" { ami = "ami-0e9bfdb247cc8de84" instance_type = "t2.micro" vpc_security_group_ids = [aws_security_group.instance.id] user_data = <<-EOF #!/bin/bash echo "Hello, T101 Study" > index.html nohup busybox httpd -f -p 80 & EOF tags = { Name = "aws-tts-seou-web02" } } resource "aws_security_group" "instance" { name = var.security_group_name ingress { from_port = 80 to_port = 80 protocol = "tcp" cidr_blocks = ["0.0.0.0/0"] } } variable "security_group_name" { description = "The name of the security group" type = string default = "terraform-aws-tts-seoul-web02-sg" } output "public_ip" { value = aws_instance.example.public_ip description = "The public IP of the Instance" } EOT aws0tts-seou-web02 새로 생성하면 ip가 변경된다. PIP=13.124.123.216 while true; do curl --connect-timeout 1 http://$PIP:80/ ; echo "------------------------------"; date; sleep 1; done