Autoscaling Group Basic
π¦ Overviewβ
This Terraform module provisions a basic Auto Scaling Group (ASG) in AWS to enable horizontal scalability of stateless compute workloads.
Itβs ideal for environments where simple scaling behavior is sufficient and advanced policies or integrations are not yet required.
β Key Featuresβ
- Launches EC2 instances using a provided AMI and instance type
- Scales compute resources between
min_size,max_size, anddesired_capacity - Supports resource and environment tagging for visibility and management
πΌ Use Casesβ
- Base infrastructure for scalable microservices
- Development or QA environments requiring dynamic instance pools
- Compute clusters without complex lifecycle policies
- Environments with manual or schedule-based scaling triggers
π₯ Input Variablesβ
| Name | Type | Description |
|---|---|---|
region | string | AWS region to deploy the Auto Scaling group |
ami_id | string | ID of the Amazon Machine Image to use for EC2 instances |
instance_type | string | EC2 instance type (e.g., t3.micro) |
subnet_ids | list | List of subnet IDs for instance placement |
min_size | number | Minimum number of instances in the group |
max_size | number | Maximum number of instances in the group |
desired_capacity | number | Desired number of instances to launch |
environment | string | Tag to specify the deployment environment (e.g., dev, prod) |
π€ Outputsβ
| Name | Description |
|---|---|
autoscaling_group_name | The name of the created Auto Scaling group |
launch_template_id | The ID of the associated launch template (if applicable) |
instance_type | The EC2 instance type used |
π Deployment Readinessβ
- β Compatible with Terraform 1.0+
- β Tested with AWS provider 5.x
- π§ͺ Use independently or as part of a larger compute layer
π οΈ Example Usageβ
module "autoscaling_group_basic" {
source = "git::ssh://git@github.com/archiphire/aws-level-1-modules.git//compute/autoscaling-group-basic?ref=v1.0.0"
region = "us-east-1"
ami_id = "ami-0123456789abcdef0"
instance_type = "t3.micro"
subnet_ids = ["subnet-abc123", "subnet-def456"]
min_size = 1
max_size = 3
desired_capacity = 2
environment = "dev"
}
terraform init
terraform plan
terraform apply
or
tofu init
tofu plan
tofu apply
π§Ή Cleanup Optionsβ
For testing:
terraform destroy
or
tofu destroy
For production:
Manually delete the Auto Scaling group and related resources via the AWS Console or CLI to prevent disruption of live services.
π‘οΈ Notesβ
This is a Level 1 compute module intended for foundational ASG setups. For advanced features like lifecycle hooks, CloudWatch alarms, or ALB/NLB integration, use a composed Level 2 module or add orchestration manually.
π 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.