def create_cluster(client, cluster_name, log_s3_uri, release_label, instance_type, instance_count):
  """Create a EMR cluster."""
  response = client.run_job_flow(
    Name=cluster_name,
    LogUri=log_s3_uri,
    ReleaseLabel=release_label,
    Applications=[
      {
        'Name': 'Spark'
      }
    ],
    BootstrapActions=[
      {
        'Name': 'Maximize Spark Default Config',
        'ScriptBootstrapAction': {
          'Path': 's3://support.elasticmapreduce/spark/maximize-spark-default-config',
        }
      },
    ],
    Instances= {
        'MasterInstanceType': instance_type,
        'SlaveInstanceType': instance_type,
        'InstanceCount': instance_count,
        'KeepJobFlowAliveWhenNoSteps':True,
        'TerminationProtected':False,

    },
    VisibleToAllUsers=True,
    JobFlowRole='EMR_EC2_DefaultRole',
    ServiceRole='EMR_DefaultRole'
  )
  return response