AWS EMR: Enable auto-termination-policy in cloudformation

Viewed 497

I am trying to enable auto termination policy in EMR. Here is the documentation https://docs.aws.amazon.com/emr/latest/ManagementGuide/emr-auto-termination-policy.html

I can easily do it via Console, AWS CLI and also using Python SDK (boto3). But I want to enable this in the cloudformation template such that whenever I create an EMR it automatically takes this policy and terminates the cluster if its idle for certain time. Unfortunately I didn't find any documentation for that. In fact I'm not sure if that's even possible or not.

1 Answers

There is an AutoTerminationPolicy config parameter for the above use case. Something like the following should do the trick:

"AutoTerminationPolicy": {
    "IdleTimeout": 10800, # 3 hours
}

FWIW, this isn't specified anywhere in the user guide documentation. But after some research found it here.

Related