20 lines
540 B
HCL
20 lines
540 B
HCL
|
|
resource "aws_instance" "ec2_vm" {
|
|
ami = "ami-02a53b0d62d37a757" # Replace with a valid AMI ID for your region
|
|
instance_type = "t2.micro" # Free tier eligible instance type
|
|
security_groups = [aws_security_group.ec2_sg.name]
|
|
key_name = "theocorp" # Replace with your AWS key pair name
|
|
|
|
tags = {
|
|
Name = "pangolin"
|
|
}
|
|
}
|
|
|
|
resource "aws_eip" "ec2_eip" {
|
|
instance = aws_instance.ec2_vm.id
|
|
}
|
|
|
|
output "instance_public_ip" {
|
|
description = "Public IP of the EC2 instance"
|
|
value = aws_eip.ec2_eip.public_ip
|
|
} |