Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(stepfunctions-tasks): add AutoTerminationPolicy.IdleTimeout to EmrCreateCluster #29954

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -219,7 +219,7 @@
{
"Ref": "EmrCreateClusterServiceRole5251910D"
},
"\",\"ReleaseLabel\":\"emr-5.36.1\",\"Tags\":[{\"Key\":\"Key\",\"Value\":\"Value\"},{\"Key\":\"for-use-with-amazon-emr-managed-policies\",\"Value\":\"true\"}],\"VisibleToAllUsers\":true}}}}"
"\",\"AutoTerminationPolicy\":{\"IdleTimeout\":120},\"ReleaseLabel\":\"emr-6.14.0\",\"Tags\":[{\"Key\":\"Key\",\"Value\":\"Value\"},{\"Key\":\"for-use-with-amazon-emr-managed-policies\",\"Value\":\"true\"}],\"VisibleToAllUsers\":true}}}}"
]
]
},
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -2,13 +2,14 @@ import * as sfn from 'aws-cdk-lib/aws-stepfunctions';
import { App, Stack } from 'aws-cdk-lib';
import { IntegTest } from '@aws-cdk/integ-tests-alpha';
import { EmrCreateCluster } from 'aws-cdk-lib/aws-stepfunctions-tasks';
import * as cdk from 'aws-cdk-lib/core';

const app = new App();

const stack = new Stack(app, 'aws-cdk-emr-create-cluster-with-on-demand-instance-fleet');

const step = new EmrCreateCluster(stack, 'EmrCreateCluster', {
releaseLabel: 'emr-5.36.1',
releaseLabel: 'emr-6.14.0',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason on why we need to update the version? As from the readme, it is mentioned emr release label above 5.30.0 should work.

instances: {
instanceFleets: [{
instanceFleetType: EmrCreateCluster.InstanceRoleType.MASTER,
Expand All @@ -27,6 +28,9 @@ const step = new EmrCreateCluster(stack, 'EmrCreateCluster', {
},
name: 'Cluster',
integrationPattern: sfn.IntegrationPattern.RUN_JOB,
autoTerminationPolicy: {
idleTimeout: cdk.Duration.seconds(120),
},
tags: {
Key: 'Value',
},
Expand Down
15 changes: 15 additions & 0 deletions packages/aws-cdk-lib/aws-stepfunctions-tasks/README.md
Expand Up @@ -730,6 +730,21 @@ new tasks.EmrCreateCluster(this, 'Create Cluster', {
});
```

If you want to use an [auto-termination policy](https://docs.aws.amazon.com/emr/latest/ManagementGuide/emr-auto-termination-policy.html),
you can specify the `autoTerminationPolicy` property. Set the `idleTimeout` as a `Duration` between 60 seconds and 7 days.
`autoTerminationPolicy` requires the EMR release label to be 5.30.0 or above.

```ts
new tasks.EmrCreateCluster(this, 'Create Cluster', {
instances: {},
name: 'ClusterName',
autoTerminationPolicy: {
idleTimeout: Duration.seconds(120),
},
});
```


### Termination Protection

Locks a cluster (job flow) so the EC2 instances in the cluster cannot be
Expand Down