Skip to content

Commit

Permalink
Create ec2.tf
Browse files Browse the repository at this point in the history
  • Loading branch information
motatoes authored Nov 21, 2024
1 parent 97ec303 commit 7ad9cb7
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions dev-ec2/ec2.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

resource "aws_instance" "example" {
ami = "ami-0e731c8a588258d0d" # Amazon Linux 2023 AMI in us-east-1
instance_type = "t2.micro"

tags = {
Name = "example-instance"
}

vpc_security_group_ids = [aws_security_group.instance.id]
}

resource "aws_security_group" "instance" {
name = "example-instance"

ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}

egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
}

output "public_ip" {
value = aws_instance.example.public_ip
}

0 comments on commit 7ad9cb7

Please sign in to comment.