Assigning static ip to gcp vm using node js script

19 Views Asked by At

I am trying to assign static ip to gcp VM using a node js script,

so far I have been able to create static ip globally but I am not able to understand weird documentation google gloud platform has

    'use strict';
    const compute = require('@google-cloud/compute');
    const { GlobalAddressesClient } = require('@google-cloud/compute').v1;

    const project = "test-1234";

    const addressResource = {
        name: "test-static-3"
    }


    // Instantiates a client
    const computeClient = new GlobalAddressesClient({ keyFile: './keys.json' });

    // create ip addredd
    async function callInsert() {
        // Construct request
        const request = {
            addressResource,
            project,
        };

        // Run request
        const response = await computeClient.insert(request);
        console.log(response);
    }
    callInsert();

with above script I can create a static ip globally...

0

There are 0 best solutions below