Skip to content

EMR

CloudMock emulates Amazon EMR, supporting cluster lifecycle, job flow steps, instance groups, security configurations, and tagging. Cluster state transitions are simulated using the lifecycle state machine.

OperationStatusNotes
RunJobFlowSupportedCreates an EMR cluster; state: STARTING → BOOTSTRAPPING → RUNNING
DescribeClusterSupportedReturns cluster details and status
ListClustersSupportedLists clusters with state filtering
TerminateJobFlowsSupportedTerminates one or more clusters
AddJobFlowStepsSupportedAdds steps to a running cluster
ListStepsSupportedLists steps for a cluster
DescribeStepSupportedReturns step details and status
AddInstanceGroupsSupportedAdds MASTER, CORE, or TASK groups
ListInstanceGroupsSupportedLists instance groups for a cluster
ModifyInstanceGroupsSupportedUpdates instance counts
SetTerminationProtectionSupportedEnables or disables termination protection
SetVisibleToAllUsersSupportedSets cluster visibility
AddTagsSupportedAdds tags to a cluster
RemoveTagsSupportedRemoves tags from a cluster
CreateSecurityConfigurationSupportedStores JSON security configuration
DescribeSecurityConfigurationSupportedReturns security configuration by name
ListSecurityConfigurationsSupportedLists all security configurations
DeleteSecurityConfigurationSupportedDeletes a security configuration
STARTING → BOOTSTRAPPING → RUNNING → WAITING → TERMINATING → TERMINATED
PENDING → RUNNING → COMPLETED / FAILED
import { EMRClient, RunJobFlowCommand, CreateSecurityConfigurationCommand } from '@aws-sdk/client-emr';
const client = new EMRClient({
endpoint: 'http://localhost:4566',
region: 'us-east-1',
credentials: { accessKeyId: 'test', secretAccessKey: 'test' },
});
await client.send(new CreateSecurityConfigurationCommand({
Name: 'my-security-config',
SecurityConfiguration: JSON.stringify({
EncryptionConfiguration: { EnableInTransitEncryption: true },
}),
}));
const { JobFlowId } = await client.send(new RunJobFlowCommand({
Name: 'my-cluster',
ReleaseLabel: 'emr-6.10.0',
SecurityConfiguration: 'my-security-config',
Instances: { MasterInstanceType: 'm5.xlarge', InstanceCount: 3 },
ServiceRole: 'EMR_DefaultRole',
JobFlowRole: 'EMR_EC2_DefaultRole',
}));
console.log(JobFlowId);
import boto3, json
client = boto3.client('emr',
endpoint_url='http://localhost:4566',
region_name='us-east-1',
aws_access_key_id='test',
aws_secret_access_key='test')
client.create_security_configuration(
Name='my-security-config',
SecurityConfiguration=json.dumps({'EncryptionConfiguration': {'EnableInTransitEncryption': True}}))
response = client.run_job_flow(
Name='my-cluster',
ReleaseLabel='emr-6.10.0',
Instances={'MasterInstanceType': 'm5.xlarge', 'InstanceCount': 3},
ServiceRole='EMR_DefaultRole',
JobFlowRole='EMR_EC2_DefaultRole')
print(response['JobFlowId'])
cloudmock.yml
services:
elasticmapreduce:
enabled: true
  • No actual Hadoop/Spark clusters are provisioned
  • Steps are stored but not executed against real compute
  • Instance groups do not launch real EC2 instances
  • Security configurations are stored as JSON blobs without enforcement