Skip to content

JobTemplate

Source: src/AWS/EMRContainers/JobTemplate.ts

An Amazon EMR on EKS job template — a stored set of StartJobRun values (execution role, release label, job driver, configuration) that can be referenced by ID when starting job runs, optionally with ${placeholder} parameters filled in per run.

Job templates are account-level and fully immutable: any change (including tags, which the tagging API does not support post-create for templates) replaces the template. They pair with the AWS.EMRContainers.StartJobRun binding — a Lambda can start a templated Spark job with just the template ID and parameter values.

A Spark Job Template

import * as AWS from "alchemy/AWS";
const template = yield* AWS.EMRContainers.JobTemplate("EtlTemplate", {
jobTemplateData: {
executionRoleArn: jobRole.roleArn,
releaseLabel: "emr-7.5.0-latest",
jobDriver: {
sparkSubmitJobDriver: {
entryPoint: "s3://my-bucket/scripts/etl.py",
sparkSubmitParameters: "--conf spark.executor.instances=2",
},
},
},
});

Parameterized Template

const template = yield* AWS.EMRContainers.JobTemplate("Parameterized", {
jobTemplateData: {
executionRoleArn: jobRole.roleArn,
releaseLabel: "emr-7.5.0-latest",
jobDriver: {
sparkSubmitJobDriver: { entryPoint: "${EntryPoint}" },
},
parameterConfiguration: {
EntryPoint: { type: "STRING" },
},
},
});
// StartJobRun with jobTemplateId + jobTemplateParameters: { EntryPoint: "s3://..." }