AWS.EMRServerless reference
Application
Section titled “Application”Source:
src/AWS/EMRServerless/Application.ts
An Amazon EMR Serverless application — a serverless Spark or Hive
environment that automatically provisions and scales workers per job,
with no cluster to manage. An application in the CREATED or STOPPED
state costs nothing; billing only occurs for workers while the application
is started (including any pre-initialized initialCapacity).
Application: Creating Applications
Section titled “Application: Creating Applications”Spark Application
import * as AWS from "alchemy/AWS";
const app = yield* AWS.EMRServerless.Application("Spark", { releaseLabel: "emr-7.9.0",});// app.applicationId is passed to StartJobRunHive Application with Auto-Stop Tuning
const app = yield* AWS.EMRServerless.Application("Hive", { type: "HIVE", releaseLabel: "emr-7.9.0", autoStartConfiguration: { enabled: true }, autoStopConfiguration: { enabled: true, idleTimeout: "5 minutes" },});Application: Capacity
Section titled “Application: Capacity”const app = yield* AWS.EMRServerless.Application("Warm", { releaseLabel: "emr-7.9.0", initialCapacity: { Driver: { workerCount: 1, workerConfiguration: { cpu: "2 vCPU", memory: "4 GB" }, }, Executor: { workerCount: 2, workerConfiguration: { cpu: "2 vCPU", memory: "4 GB" }, }, }, maximumCapacity: { cpu: "16 vCPU", memory: "64 GB" },});Application: Networking
Section titled “Application: Networking”const app = yield* AWS.EMRServerless.Application("InVpc", { releaseLabel: "emr-7.9.0", networkConfiguration: { subnetIds: [subnet.subnetId], securityGroupIds: [securityGroup.securityGroupId], },});CancelJobRun
Section titled “CancelJobRun”Source:
src/AWS/EMRServerless/CancelJobRun.ts
Runtime binding for emr-serverless:CancelJobRun.
Cancels a running or queued job run on the bound Application — the
kill switch for a runaway or superseded job. Provide the implementation
with Effect.provide(AWS.EMRServerless.CancelJobRunHttp).
CancelJobRun: Running Jobs
Section titled “CancelJobRun: Running Jobs”// initconst cancelJobRun = yield* AWS.EMRServerless.CancelJobRun(app);
// runtimeyield* cancelJobRun({ jobRunId });GetDashboardForJobRun
Section titled “GetDashboardForJobRun”Source:
src/AWS/EMRServerless/GetDashboardForJobRun.ts
Runtime binding for emr-serverless:GetDashboardForJobRun.
Creates a pre-signed URL to the live Spark/Tez UI (or Spark History
Server) for a job run on the bound Application — hand it to an
on-call engineer to debug a slow or failed job without console access.
Provide the implementation with
Effect.provide(AWS.EMRServerless.GetDashboardForJobRunHttp).
GetDashboardForJobRun: Dashboards
Section titled “GetDashboardForJobRun: Dashboards”// initconst getDashboardForJobRun = yield* AWS.EMRServerless.GetDashboardForJobRun(app);
// runtimeconst { url } = yield* getDashboardForJobRun({ jobRunId });GetJobRun
Section titled “GetJobRun”Source:
src/AWS/EMRServerless/GetJobRun.ts
Runtime binding for emr-serverless:GetJobRun.
Reads a job run’s full detail on the bound Application — state,
driver, resource utilization, timeout — so a function can poll a submitted
job to completion or inspect why it failed. Provide the implementation
with Effect.provide(AWS.EMRServerless.GetJobRunHttp).
GetJobRun: Running Jobs
Section titled “GetJobRun: Running Jobs”// initconst getJobRun = yield* AWS.EMRServerless.GetJobRun(app);
// runtimeconst { jobRun } = yield* getJobRun({ jobRunId });yield* Effect.log(`${jobRun.jobRunId} is ${jobRun.state}`);GetResourceDashboard
Section titled “GetResourceDashboard”Source:
src/AWS/EMRServerless/GetResourceDashboard.ts
Runtime binding for emr-serverless:GetResourceDashboard.
Creates a pre-signed dashboard URL for a specific resource (e.g. a
worker) of the bound Application. Provide the implementation with
Effect.provide(AWS.EMRServerless.GetResourceDashboardHttp).
GetResourceDashboard: Dashboards
Section titled “GetResourceDashboard: Dashboards”// initconst getResourceDashboard = yield* AWS.EMRServerless.GetResourceDashboard(app);
// runtimeconst { url } = yield* getResourceDashboard({ resourceId, resourceType });GetSession
Section titled “GetSession”Source:
src/AWS/EMRServerless/GetSession.ts
Runtime binding for emr-serverless:GetSession.
Reads an interactive session’s detail on the bound Application —
state, execution role, idle time, resource utilization. Provide the
implementation with Effect.provide(AWS.EMRServerless.GetSessionHttp).
GetSession: Interactive Sessions
Section titled “GetSession: Interactive Sessions”// initconst getSession = yield* AWS.EMRServerless.GetSession(app);
// runtimeconst { session } = yield* getSession({ sessionId });yield* Effect.log(`${session.sessionId} is ${session.state}`);GetSessionEndpoint
Section titled “GetSessionEndpoint”Source:
src/AWS/EMRServerless/GetSessionEndpoint.ts
Runtime binding for emr-serverless:GetSessionEndpoint.
Resolves the connection endpoint and short-lived auth token for an
interactive session on the bound Application. The authToken in
the response is Redacted — unwrap it with Redacted.value only at the
point of use. Provide the implementation with
Effect.provide(AWS.EMRServerless.GetSessionEndpointHttp).
GetSessionEndpoint: Interactive Sessions
Section titled “GetSessionEndpoint: Interactive Sessions”// initconst getSessionEndpoint = yield* AWS.EMRServerless.GetSessionEndpoint(app);
// runtimeconst { endpoint, authToken } = yield* getSessionEndpoint({ sessionId });ListJobRunAttempts
Section titled “ListJobRunAttempts”Source:
src/AWS/EMRServerless/ListJobRunAttempts.ts
Runtime binding for emr-serverless:ListJobRunAttempts.
Enumerates the attempts of a retried job run on the bound
Application — how many times the retry policy re-ran the job and
how each attempt ended. Provide the implementation with
Effect.provide(AWS.EMRServerless.ListJobRunAttemptsHttp).
ListJobRunAttempts: Running Jobs
Section titled “ListJobRunAttempts: Running Jobs”// initconst listJobRunAttempts = yield* AWS.EMRServerless.ListJobRunAttempts(app);
// runtimeconst { jobRunAttempts } = yield* listJobRunAttempts({ jobRunId });ListJobRuns
Section titled “ListJobRuns”Source:
src/AWS/EMRServerless/ListJobRuns.ts
Runtime binding for emr-serverless:ListJobRuns.
Enumerates job runs on the bound Application, optionally filtered
by state, creation window, or mode — so a function can report on running
or recently failed jobs. Provide the implementation with
Effect.provide(AWS.EMRServerless.ListJobRunsHttp).
ListJobRuns: Running Jobs
Section titled “ListJobRuns: Running Jobs”// initconst listJobRuns = yield* AWS.EMRServerless.ListJobRuns(app);
// runtimeconst { jobRuns } = yield* listJobRuns({ states: ["RUNNING"] });ListSessions
Section titled “ListSessions”Source:
src/AWS/EMRServerless/ListSessions.ts
Runtime binding for emr-serverless:ListSessions.
Enumerates interactive sessions on the bound Application,
optionally filtered by state or creation window. Provide the
implementation with Effect.provide(AWS.EMRServerless.ListSessionsHttp).
ListSessions: Interactive Sessions
Section titled “ListSessions: Interactive Sessions”// initconst listSessions = yield* AWS.EMRServerless.ListSessions(app);
// runtimeconst { sessions } = yield* listSessions({ states: ["IDLE"] });StartApplication
Section titled “StartApplication”Source:
src/AWS/EMRServerless/StartApplication.ts
Runtime binding for emr-serverless:StartApplication.
Starts the bound Application — pre-warming its pre-initialized
capacity ahead of a burst of job submissions so the first job skips the
application cold start. Provide the implementation with
Effect.provide(AWS.EMRServerless.StartApplicationHttp).
StartApplication: Application Control
Section titled “StartApplication: Application Control”// initconst startApplication = yield* AWS.EMRServerless.StartApplication(app);
// runtimeyield* startApplication();StartJobRun
Section titled “StartJobRun”Source:
src/AWS/EMRServerless/StartJobRun.ts
Runtime binding for emr-serverless:StartJobRun.
Submits a Spark or Hive job to the bound Application — the
serverless equivalent of spark-submit. The application id is injected
from the binding; the caller supplies the job driver, the execution role
the job assumes, and optional configuration overrides. Grants
iam:PassRole (conditioned to emr-serverless.amazonaws.com) so the
function can hand the service the execution role. Provide the
implementation with Effect.provide(AWS.EMRServerless.StartJobRunHttp).
StartJobRun: Running Jobs
Section titled “StartJobRun: Running Jobs”// init — bind the operation to the applicationconst startJobRun = yield* AWS.EMRServerless.StartJobRun(app);
// runtimeconst run = yield* startJobRun({ executionRoleArn: jobRoleArn, jobDriver: { sparkSubmit: { entryPoint: "s3://my-scripts/etl.py", entryPointArguments: ["--date", "2026-07-14"], }, }, executionTimeoutMinutes: 60,});yield* Effect.log(`started ${run.jobRunId}`);StartSession
Section titled “StartSession”Source:
src/AWS/EMRServerless/StartSession.ts
Runtime binding for emr-serverless:StartSession.
Starts an interactive session on the bound Application (the
application must enable interactiveConfiguration). The session assumes
the given execution role; grants iam:PassRole (conditioned to
emr-serverless.amazonaws.com) accordingly. Provide the implementation
with Effect.provide(AWS.EMRServerless.StartSessionHttp).
StartSession: Interactive Sessions
Section titled “StartSession: Interactive Sessions”// initconst startSession = yield* AWS.EMRServerless.StartSession(app);
// runtimeconst session = yield* startSession({ executionRoleArn: sessionRoleArn });yield* Effect.log(`started ${session.sessionId}`);StopApplication
Section titled “StopApplication”Source:
src/AWS/EMRServerless/StopApplication.ts
Runtime binding for emr-serverless:StopApplication.
Stops the bound Application, releasing its pre-initialized
capacity so it stops billing — e.g. a scheduled cost-control function that
shuts the application down outside business hours. Provide the
implementation with Effect.provide(AWS.EMRServerless.StopApplicationHttp).
StopApplication: Application Control
Section titled “StopApplication: Application Control”// initconst stopApplication = yield* AWS.EMRServerless.StopApplication(app);
// runtimeyield* stopApplication();TerminateSession
Section titled “TerminateSession”Source:
src/AWS/EMRServerless/TerminateSession.ts
Runtime binding for emr-serverless:TerminateSession.
Terminates an interactive session on the bound Application,
releasing its workers — e.g. a cost-control function reaping sessions
left idle past a policy window. Provide the implementation with
Effect.provide(AWS.EMRServerless.TerminateSessionHttp).
TerminateSession: Interactive Sessions
Section titled “TerminateSession: Interactive Sessions”// initconst terminateSession = yield* AWS.EMRServerless.TerminateSession(app);
// runtimeyield* terminateSession({ sessionId });