Skip to content

Instantly share code, notes, and snippets.

Last active July 20, 2018 09:13
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save imujjwal96/09d7283a7e114999d4b988629bbb8be6 to your computer and use it in GitHub Desktop.
AWS JavaScript SDK to launch an EMR Cluster with EMRFS Consistent View enabled.
var express = require('express');
var router = express.Router();
var AWS = require('aws-sdk');
AWS.config.update({region: 'ap-south-1'});
router.get('/', function(req, res, next) {
res.render('index', { title: 'Express' });
});'/perform', function (req, res, next) {
var emr = new AWS.EMR();
var params = {
Instances: {
Ec2KeyName: 'training-key',
Ec2SubnetId: 'subnet-xxxxxxxx',
EmrManagedMasterSecurityGroup: 'sg-xxxxxxxxxxxxxxxxx',
EmrManagedSlaveSecurityGroup: 'sg-xxxxxxxxxxxxxxxxx',
HadoopVersion: '2.8.3',
TerminationProtected: false,
InstanceGroups: [{
Name: "Master Instance Group",
InstanceRole: "MASTER",
InstanceCount: 1,
InstanceType: "m4.large",
Market: "ON_DEMAND"
Name: 'Testing-cluster',
Applications: [
Name: 'Ganglia',
Name: 'Spark',
Configurations: [
Classification: 'emrfs-site',
Properties: {
'fs.s3.consistent.retryPeriodSeconds': '10',
'fs.s3.consistent.retryCount': '5',
'fs.s3.consistent': 'true',
'fs.s3.consistent.metadata.tableName': 'EmrFSMetadata'
JobFlowRole: 'EMR_EC2_DefaultRole',
LogUri: 's3://aws-logs-xxxxxxxxxxxx-ap-south-1/elasticmapreduce/',
ReleaseLabel: 'emr-5.15.0',
ServiceRole: 'EMR_DefaultRole',
emr.runJobFlow(params, function(err, data) {
if (err) console.log(err, err.stack);
else console.log(data);
module.exports = router;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment