Skip to content

No external ip for created VM #953

Description

@Omberone

Hello,
We don't get an external IP assigned for our newly created VM. We create a VM with the following script;

var zone = gce.zone('europe-west1-b');
var name = 'testing';
var BUILDER_MACHINE_CONFIG = {
    machineType: "n1-standard-1",
    disks: [{
        autoDelete: true,
        boot: true,
        initializeParams: {
            sourceImage: 'https://www.googleapis.com/compute/v1/projects/PROJECT/global/images/custom-img'
        }
    }]
};
zone.createVM(name, BUILDER_MACHINE_CONFIG, function(err, vm, operation, apiResponse) {
        console.log(err);
        operation.on('complete', function(metadata) {
                console.log('completed');
        });
});

And it does create an instance successfully, but no IP is assigned and there is no option to SSH into it. Anyone able to shed some light on this?

Activity

  1. Omberone commented on Nov 20, 2015

    @Omberone
    Author

    So the IP is not ephemeral by default, and we don't know how to set it to be ephemeral when we create the instance.

  2. Omberone commented on Nov 20, 2015

    @Omberone
    Author

    Turns out I didn't have an accessConfig set, which prompted the instance to not be created with an ephemeral IP. Here's the functioning code;

    var zone = gce.zone('europe-west1-b');
    var name = 'testing';
    var BUILDER_MACHINE_CONFIG = {
        machineType: "n1-standard-1",
        disks: [{
            autoDelete: true,
            boot: true,
            initializeParams: {
                sourceImage: 'https://www.googleapis.com/compute/v1/projects/PROJECT/global/images/custom-img'
            }
        }],
        networkInterfaces: [{
            network: 'global/networks/default',
            accessConfigs: [
            {
                kind: 'compute#accessConfig'
            }]
        }]
    };
    zone.createVM(name, BUILDER_MACHINE_CONFIG, function(err, vm, operation, apiResponse) {
            console.log(err);
            operation.on('complete', function(metadata) {
                    console.log('completed');
            });
    });

    Hope this helps someone else in the same situation!

  3. NickZ commented on Feb 21, 2017

    @NickZ

    thanks, this helped me out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions