Batch Compute Environment
π¦ Overviewβ
This Terraform module provisions a Batch Compute Environment in AWS to support scalable, cost-efficient batch processing workloads.
Itβs designed for use cases like data analytics, model training, ETL, and other asynchronous jobs requiring managed compute infrastructure.
β Key Featuresβ
- Creates a managed compute environment for AWS Batch
- Supports custom instance types, vCPU limits, and allocation strategies
- Allows subnet and security group configuration for full VPC integration
πΌ Use Casesβ
- High-performance computing (HPC) jobs and render farms
- Machine learning model training and batch inference
- ETL pipelines and large-scale data preprocessing
- Genomics, financial simulations, or scientific computation
π₯ Input Variablesβ
| Name | Type | Description |
|---|---|---|
region | string | AWS region to deploy the Batch environment |
compute_env_name | string | Name of the compute environment |
instance_types | list | List of allowed EC2 instance types |
max_vcpus | number | Maximum number of vCPUs allowed |
subnets | list | List of subnet IDs for VPC placement |
security_group_ids | list | List of security group IDs for the compute environment |
environment | string | Tag to specify the deployment environment (e.g., dev, prod) |
π€ Outputsβ
| Name | Description |
|---|---|
compute_environment_name | The name of the created compute environment |
compute_environment_arn | The ARN of the compute environment |
max_vcpus | The maximum number of virtual CPUs allowed |
π Deployment Readinessβ
- β Compatible with Terraform 1.0+
- β Tested with AWS provider 5.x
- π§ͺ Requires a compute IAM role (e.g.,
AWSBatchServiceRole)
π οΈ Example Usageβ
module "batch_compute_environment_deployment" {
source = "git::ssh://git@github.com/archiphire/aws-level-1-modules.git//compute/batch-compute-environment?ref=v1.0.0"
region = "us-east-1"
compute_env_name = "archiphire-batch-env"
instance_types = ["c5.large", "m5.large"]
max_vcpus = 16
subnets = ["subnet-abc123", "subnet-def456"]
security_group_ids = ["sg-12345678"]
environment = "prod"
}
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 Batch environment using the AWS Console or CLI to avoid disrupting jobs in a production pipeline.
π‘οΈ Notesβ
This is a Level 1 compute module designed as a base layer for AWS Batch setups. To run jobs, pair this with modules for Batch job queues and job definitions.
π 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.