A machine type, also called an instance type, specifies an AWS virtual machine’s capabilities, including CPU and memory limits. Different workloads can require different types, so selecting the type should be part of the configuration rather than a hard-coded decision. section 3.8
Terraform makes machine-type selection operationally useful by exposing it as module configuration:
- Declare an instance_type input variable with the string type, description, and an optional default. section 3.8.2
- Pass var.instance_type to the aws_instance resource so callers can choose the machine without editing the module. section 3.8.2
- Use a modest default such as t3.micro when cost-conscious testing is the priority, while allowing more powerful choices for other workloads. section 2.1.5 section 3.8
Selecting a machine type in a reusable module
A module can define instance_type as a string with a default of t3.micro, then assign it to the instance_type argument of aws_instance. A caller can override that value to launch a more capable machine while reusing the same module and subnet configuration.

