mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 14:10:49 -05:00
Serve PutManagedScalingPolicy, GetManagedScalingPolicy, RemoveManagedScalingPolicy, PutAutoTerminationPolicy, GetAutoTerminationPolicy, RemoveAutoTerminationPolicy, PutAutoScalingPolicy, RemoveAutoScalingPolicy, GetBlockPublicAccessConfiguration and PutBlockPublicAccessConfiguration. The managed scaling and auto termination policies are stored on the cluster and the automatic scaling policy on its instance group, as the JSON given. RunJobFlow and AddInstanceGroups accept the same policies instead of dropping them, and ListInstanceGroups reports an attached automatic scaling policy. Validation follows the API model: ComputeLimits members and minimum not above maximum, IdleTimeout 60 to 604800 seconds, automatic scaling only on core and task groups, port ranges within 0 to 65535. Block public access is kept per account and Region and starts at the AWS default (public rules blocked, port 22 permitted). The cluster mutators are synchronized, since each reads, changes and stores the whole cluster. Refs #4888
3.6 KiB
3.6 KiB
EMR
Protocol: JSON 1.1
Endpoint: http://localhost:4566/
Target prefix: X-Amz-Target: ElasticMapReduce.*
Floci emulates the Amazon EMR (Elastic MapReduce) management API. Clusters (job flows), instance groups and fleets, steps, security configurations, and tags are tracked in Floci's storage backend so the AWS CLI and SDK clients can drive the full cluster lifecycle locally. EMR does not launch real Hadoop/Spark clusters — clusters transition through their lifecycle states as a state machine.
Supported Actions
| Action | Description |
|---|---|
RunJobFlow |
Creates a new cluster (job flow) and returns its JobFlowId |
DescribeCluster |
Returns the configuration and status of a cluster |
ListClusters |
Lists clusters, filterable by state and creation time |
TerminateJobFlows |
Terminates one or more clusters |
SetTerminationProtection |
Enables or disables termination protection |
SetVisibleToAllUsers |
Sets cluster visibility for the account |
SetKeepJobFlowAliveWhenNoSteps |
Controls auto-termination when steps complete |
SetUnhealthyNodeReplacement |
Toggles unhealthy-node replacement |
ModifyCluster |
Updates cluster-level settings such as step concurrency |
AddJobFlowSteps |
Adds one or more steps to a cluster |
DescribeStep |
Returns the detail and status of a single step |
ListSteps |
Lists the steps of a cluster, filterable by state |
CancelSteps |
Cancels pending steps |
AddInstanceGroups |
Adds instance groups to a running cluster |
ListInstanceGroups |
Lists the instance groups of a cluster |
AddInstanceFleet |
Adds an instance fleet to a cluster |
ListInstanceFleets |
Lists the instance fleets of a cluster |
ListInstances |
Lists the EC2 instances of a cluster |
CreateSecurityConfiguration |
Creates a named security configuration |
DescribeSecurityConfiguration |
Returns a security configuration |
DeleteSecurityConfiguration |
Deletes a security configuration |
ListSecurityConfigurations |
Lists all security configurations |
AddTags |
Adds tags to a cluster |
RemoveTags |
Removes tags from a cluster |
PutManagedScalingPolicy |
Sets a cluster's managed scaling policy |
GetManagedScalingPolicy |
Returns a cluster's managed scaling policy |
RemoveManagedScalingPolicy |
Removes a cluster's managed scaling policy |
PutAutoTerminationPolicy |
Sets a cluster's idle timeout auto termination policy |
GetAutoTerminationPolicy |
Returns a cluster's auto termination policy |
RemoveAutoTerminationPolicy |
Removes a cluster's auto termination policy |
PutAutoScalingPolicy |
Attaches an automatic scaling policy to a core or task instance group |
RemoveAutoScalingPolicy |
Removes an instance group's automatic scaling policy |
GetBlockPublicAccessConfiguration |
Returns the account's block public access configuration for the Region |
PutBlockPublicAccessConfiguration |
Sets the account's block public access configuration for the Region |
Example
export AWS_ENDPOINT_URL=http://localhost:4566
# Create a cluster
CLUSTER_ID=$(aws emr run-job-flow \
--name "demo-cluster" \
--release-label emr-7.0.0 \
--instances InstanceGroups='[{InstanceCount=1,InstanceGroupType=MASTER,InstanceType=m5.xlarge}]' \
--query 'JobFlowId' --output text)
# Inspect it
aws emr describe-cluster --cluster-id "$CLUSTER_ID"
aws emr list-clusters
# Add a step
aws emr add-steps --cluster-id "$CLUSTER_ID" \
--steps Type=CUSTOM_JAR,Name=demo,Jar=command-runner.jar,Args=[echo,hello]
# Terminate
aws emr terminate-clusters --cluster-ids "$CLUSTER_ID"