Launch Template Basic
๐ฆ Overviewโ
This Terraform module provisions a basic AWS Launch Template, enabling consistent, reusable EC2 instance configuration across environments. It is ideal for teams standardizing compute provisioning workflows.
โ Key Featuresโ
- Creates a reusable EC2 Launch Template
- Accepts AMI ID, instance type, and template name
- Tags resources with environment and ownership metadata
- Designed for integration with Auto Scaling Groups or Spot Fleets
๐ผ Use Casesโ
- Standardize EC2 provisioning across environments
- Launch instances via ASGs, Spot Fleets, or manual methods
- Pre-define reusable compute configurations for autoscaling workloads
- Enable infrastructure-as-code repeatability across teams
๐ฅ Input Variablesโ
| Name | Type | Description |
|---|---|---|
| region | string | AWS region to deploy the launch template |
| template_name | string | Name to assign to the launch template |
| ami_id | string | AMI ID to use for EC2 instance launches |
| instance_type | string | EC2 instance type (e.g., t3.micro, m5.large) |
| environment | string | Tag value for environment (e.g., dev, staging, prod) |
๐ค Outputsโ
| Name | Description |
|---|---|
| launch_template_id | The unique ID of the created launch template |
| launch_template_name | The name of the created launch template |
๐ Deployment Readinessโ
- โ Terraform 1.0+ compatible
- โ Uses AWS Provider 5.x+
- โ๏ธ Requires
ec2:CreateLaunchTemplatepermissions - ๐ฏ Ensure AMI ID is valid for the chosen region
๐ ๏ธ Example Usageโ
module "launch_template_basic_deployment" {
source = "git::ssh://git@github.com/archiphire/aws-level-1-modules.git//compute/launch-template-basic?ref=v1.0.0"
region = "us-east-1"
template_name = "archiphire-launch-template"
ami_id = "ami-0abcdef1234567890"
instance_type = "t3.micro"
environment = "dev"
}
terraform init
terraform plan
terraform apply
or
tofu init
tofu plan
tofu apply
๐งน Cleanupโ
Terraform Destroy (Isolated Use):
terraform destroy
or
tofu destroy
Manual Deletion (Recommended for Production):
Delete the template manually via AWS Console or CLI:
aws ec2 delete-launch-template --launch-template-id <template_id>
๐ก๏ธ Notesโ
This is a Level 1 compute module designed for modular EC2 provisioning.
Pair this with Level 2 modules like Auto Scaling Group or EC2 Fleet templates for production deployments.
๐ Deployment Package Noticeโ
This module is part of the Level 1 AWS License Tier.
To access the full deployment package and source code, subscribe to Archiphire.