Search code examples
amazon-web-servicesaws-batchcost-management

Why will a disabled AWS Batch compute environment incur costs?


I want to use AWS Batch, with a managed environment. The documentation says:

Compute environments in a DISABLED state might continue to incur billing charges. To prevent additional charges, turn off and then delete the compute environment. For more information, see DeleteComputeEnvironment in the AWS Batch API Reference and Avoiding unexpected charges in the AWS Billing User Guide.

What charges would be incurred? The Batch pricing page says:

There is no additional charge for AWS Batch. You pay for AWS resources (e.g. EC2 instances, AWS Lambda functions or AWS Fargate) you create to store and run your application.

Obviously if I save my resulting data to S3, I'll incur S3 storage costs. But the documentation seems to suggest the compute environment itself incurs costs.

If I'm using a managed compute environment, I expect all containers and underlying VMs to be spun down by AWS. Do disabled environments only incur costs if they are unmanaged?


Solution

  • There are two situations where disabling a compute environment will continue to incur compute costs:

    1. If your compute environment has a minVCpus setting greater than zero, then the DISABLED compute environment will still keep instance(s) running to meet that requirement. DISABLED in this case means "do not schedule new jobs to start on these instances". If you want to keep the compute environment but do not want it to incur EC2 charges, set the minVCpus to zero. This will scale down the instances.
    2. If your compute environment has jobs running. Batch will let already running jobs go to completion UNLESS you set the terminateJobsOnUpdate is set to true. Batch will not place new jobs on the instances within that compute environment. If minVCpus is set to zero, then the instances will be shut down once all the jobs on that instance complete (or jobs are successfully terminated). You will still be charged for the time the instances remained running while the compute environment let jobs complete (or terminate). See point #1 about minVCpu > 0.

    In either case, these are EC2 charges, not a charge coming from AWS Batch itself.