Skip to main content

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โ€‹

NameTypeDescription
regionstringAWS region to deploy the launch template
template_namestringName to assign to the launch template
ami_idstringAMI ID to use for EC2 instance launches
instance_typestringEC2 instance type (e.g., t3.micro, m5.large)
environmentstringTag value for environment (e.g., dev, staging, prod)

๐Ÿ“ค Outputsโ€‹

NameDescription
launch_template_idThe unique ID of the created launch template
launch_template_nameThe name of the created launch template

๐Ÿš€ Deployment Readinessโ€‹

  • โœ… Terraform 1.0+ compatible
  • โœ… Uses AWS Provider 5.x+
  • โ˜๏ธ Requires ec2:CreateLaunchTemplate permissions
  • ๐ŸŽฏ 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.