Skip to content

NATs & Private IPs #264

@selshowk

Description

@selshowk

For GCP & AWS its relatively easy to patch the instance.create functions to support using internal IPs for VMs (I'll post some diffs later) but once you do this the VM can no longer access the internet. The solution is to create a NAT so I'm trying to look at how to implement this in each provider and if its each to patch cloudbridge to do so (I also responded to #170 mentioning this).

For GCP the change (which I've tested) seems to be very minimal. The following code works:

gr=provider.gcp_compute.routers()
nat_data = {'name': 'nat-cloudbridge-test',
   'sourceSubnetworkIpRangesToNat': 'ALL_SUBNETWORKS_ALL_IP_RANGES',
   'natIpAllocateOption': 'AUTO_ONLY',
   'logConfig': {'enable': False, 'filter': 'ALL'},
   'enableEndpointIndependentMapping': True}
gr.patch(project=provider.project_name, region=provider.region_name, router=router.name, body={'nats':[nat_data]}).execute()

Rather than a patch the above could simply be added to the router create rule depending on an optional arg?

I am investigating the equivalent for AWS (and will eventually for Azure as well). Is this something you would be interested in adding in?

Metadata

Metadata

Assignees

No one assigned

    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