| 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 | } |