2
votes

I am running a simple java HelloWorld program using docker container in AWS Batch. I have created a managed Compute Environment with following values

Minimum vCPUs 0

Desired vCPUs 0

Maximum vCPUs 256

Instance types optimal

On submitting the Job, the job is executed successfully i.e. the job is submitted to the queue, the scheduler provisions the ec2 instance ( with aws-ecs agent container and java helloworld container which is specified in Job Definition) and the job is successfully completed with the logs in CloudWatch Stream.

My issue is that after the job is succeeded the compute environment (ec2 instance) provisioned by scheduler still keeps on running instead of terminating.

Pls. suggest if I am missing anything.

2

2 Answers

2
votes

Your compute environment will terminate if it is idle near the end of an AWS Billing Hour.

Inside the Compute Environment Parameters documentation for AWS Batch, there is a definition of State. A compute environment is in the Enabled state and can accept jobs from the queue. Once the compute environment is in Disabled and idle, toward the end of an AWS billing hour the compute environment is scaled in (which will terminate your EC2 instance).

2
votes

From Oct 5, 2017

AWS Batch evaluate compute resources more frequently and immediately scale down any idle instances when there are no more runnable jobs in your job queues.
So, your compute environment instance will be terminated immediately if it is idle.

Announcement