Use HCL(Terraform) to create AWS EC2

Define main.tf
        
provider "aws" {
    region = "us-west-2"  # Replace with your desired AWS region
    }

    resource "aws_instance" "my_instance" {
    ami           = "ami-830c94e3"  # Replace with your desired AMI ID
    instance_type = "t2.micro"
    key_name      = "my-keypair"   # Replace with your SSH key pair name
    subnet_id     = "subnet-eddcdzz4"  # Replace with your desired subnet ID

    tags = {
    Name = "MyEC2Instance"
    }
    }
        
    


Let's work together...

Would you like a cup of coffee?