MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / createCluster

Function createCluster

dataproc/createCluster.js:42–69  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

40 });
41
42 async function createCluster() {
43 // Create the cluster config
44 const request = {
45 projectId: projectId,
46 region: region,
47 cluster: {
48 clusterName: clusterName,
49 config: {
50 masterConfig: {
51 numInstances: 1,
52 machineTypeUri: 'n1-standard-2',
53 },
54 workerConfig: {
55 numInstances: 2,
56 machineTypeUri: 'n1-standard-2',
57 },
58 },
59 },
60 };
61
62 // Create the cluster
63 const [operation] = await client.createCluster(request);
64 const [response] = await operation.promise();
65
66 // Output a success message
67 console.log(`Cluster created successfully: ${response.clusterName}`);
68 // [END dataproc_create_cluster]
69 }
70
71 createCluster();
72}

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected