1

I'm currently using google cloud's node.js google compute package to create an address.

However, it doesn't seem like there's any way to create global (not regional) addresses, as the node.js package requires a region. Through gcloud's REST api, it seems like there's a way to create global addresses.

For global static IPv6 addresses, make a request to:

https://www.googleapis.com/compute/v1/projects/[PROJECT_ID]/global/addresses Your request body should contain the following:

{ "name": "[ADDRESS_NAME]", "ipVersion": "IPV6" }

Does anybody know if there's a way to make global addresses using the package?

ForgetfulFellow
  • 2,477
  • 2
  • 22
  • 33

1 Answers1

1

All of the REST clients expose a request function you can call

const Compute = require('@google-cloud/compute');
const compute = new Compute();

const request = {
  method: 'POST',
  uri: '/global/addresses',
  json: {name: 'my-address'}
};

compute.request(request, (err, resp) => {
  if (err) {
    return console.error(err);
  }

  compute
    .operation(resp.name)
    .on('error', err => console.error(err))
    .on('complete', response => {
      // good to go!
    });
});
callmehiphop
  • 636
  • 5
  • 10