Skip to main content

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​

NameTypeDescription
regionstringAWS region to deploy the Batch environment
compute_env_namestringName of the compute environment
instance_typeslistList of allowed EC2 instance types
max_vcpusnumberMaximum number of vCPUs allowed
subnetslistList of subnet IDs for VPC placement
security_group_idslistList of security group IDs for the compute environment
environmentstringTag to specify the deployment environment (e.g., dev, prod)

πŸ“€ Outputs​

NameDescription
compute_environment_nameThe name of the created compute environment
compute_environment_arnThe ARN of the compute environment
max_vcpusThe 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.