Skip to content

Networking

This page lists the IAM bindings available to policy rules for each network-related API operation: operation, parameters and resources. For general information on how rules and bindings work, see the IAM policy guide.

Overview

The operations below belong to the networking IAM service.

Important

Attaching and detaching a Compute instance to/from a VPC Subnet (attach-instance-to-subnet, detach-instance-from-subnet) belong to the compute service class, not networking. Rules for these operations must be written in the compute service policy. See attach-instance-to-subnet and detach-instance-from-subnet in the compute reference.

OperationEndpointResources
create-vpcPOST /vpc-
list-vpcsGET /vpc-
get-vpcGET /vpc/<id>vpc
update-vpcPUT /vpc/<id>vpc
delete-vpcDELETE /vpc/<id>vpc
create-subnetPOST /vpc/<vpc-id>/subnetvpc
list-subnetsGET /vpc/<vpc-id>/subnetvpc
get-subnetGET /vpc/<vpc-id>/subnet/<id>vpc, subnet
update-subnetPUT /vpc/<vpc-id>/subnet/<id>vpc, subnet
delete-subnetDELETE /vpc/<vpc-id>/subnet/<id>vpc, subnet
create-routePOST /vpc/<vpc-id>/subnet/<subnet-id>/routevpc, subnet
delete-routeDELETE /vpc/<vpc-id>/subnet/<subnet-id>/route/<id>vpc, subnet
list-routesGET /vpc/<vpc-id>/subnet/<subnet-id>/routevpc, subnet
list-vpc-routesGET /vpc/<vpc-id>/routevpc

Routes are not exposed as a resource. To write rules about routes, use parameters (for example parameters.destination on create-route) together with the parent vpc and subnet resources.

Resources

Resources are only loaded when a rule in the networking service policy references them.

vpc

The VPC targeted by the request, or the parent VPC of the targeted subnet or route.

  • resources.vpc.id
  • resources.vpc.name
  • resources.vpc.description
  • resources.vpc.created_at
  • resources.vpc.default: true if this is the organization’s default VPC
  • resources.vpc.labels

subnet

The subnet targeted by the request, or the parent subnet of the targeted route.

  • resources.subnet.id
  • resources.subnet.name
  • resources.subnet.description
  • resources.subnet.created_at
  • resources.subnet.addressfamily
  • resources.subnet.address_space
  • resources.subnet.ipv4_block
  • resources.subnet.labels
  • resources.subnet.instances: list of attached instances, each with id, name and ipv4

VPC operations

create-vpc

POST /vpc - Create a VPC

Parameters:

  • parameters.name
  • parameters.description
  • parameters.labels

Resources:

None.

list-vpcs

GET /vpc - List VPCs

Resources:

None.

get-vpc

GET /vpc/<id> - Retrieve VPC details

Parameters:

  • parameters.id

Resources:

update-vpc

PUT /vpc/<id> - Update a VPC

Parameters:

  • parameters.id
  • parameters.name
  • parameters.description
  • parameters.labels

Resources:

delete-vpc

DELETE /vpc/<id> - Delete a VPC

Parameters:

  • parameters.id

Resources:

Subnet operations

create-subnet

POST /vpc/<vpc-id>/subnet - Create a Subnet

Parameters:

  • parameters.vpc_id
  • parameters.name
  • parameters.description
  • parameters.labels
  • parameters.addressfamily
  • parameters.address_space
  • parameters.ipv4_block

Resources:

list-subnets

GET /vpc/<vpc-id>/subnet - List Subnets

Parameters:

  • parameters.vpc_id

Resources:

get-subnet

GET /vpc/<vpc-id>/subnet/<id> - Retrieve Subnet details

Parameters:

  • parameters.vpc_id
  • parameters.id

Resources:

update-subnet

PUT /vpc/<vpc-id>/subnet/<id> - Update a Subnet

Parameters:

  • parameters.vpc_id
  • parameters.id
  • parameters.name
  • parameters.description
  • parameters.labels

Resources:

delete-subnet

DELETE /vpc/<vpc-id>/subnet/<id> - Delete a Subnet

Parameters:

  • parameters.vpc_id
  • parameters.id

Resources:

Route operations

create-route

POST /vpc/<vpc-id>/subnet/<subnet-id>/route - Create a route

Parameters:

  • parameters.vpc_id
  • parameters.subnet_id
  • parameters.description
  • parameters.destination
  • parameters.target

Resources:

delete-route

DELETE /vpc/<vpc-id>/subnet/<subnet-id>/route/<id> - Delete a route

Parameters:

  • parameters.vpc_id
  • parameters.subnet_id
  • parameters.id: the route ID

Resources:

list-routes

GET /vpc/<vpc-id>/subnet/<subnet-id>/route - List Subnet routes

Parameters:

  • parameters.vpc_id
  • parameters.subnet_id

Resources:

list-vpc-routes

GET /vpc/<vpc-id>/route - List VPC routes

Parameters:

  • parameters.vpc_id

Resources:

Examples

Restrict VPC management to VPCs labelled env=dev

create-vpc and list-vpcs load no resource, so the first rule lets them through. Every other networking operation is only allowed on VPCs labelled env=dev. Any request that matches no rule is denied.

{
  "default-service-strategy": "deny",
  "services": {
    "networking": {
      "type": "rules",
      "rules": [
        {
          "action": "allow",
          "expression": "!has(resources.vpc)"
        },
        {
          "action": "allow",
          "expression": "has(resources.vpc.labels.env) && resources.vpc.labels.env == 'dev'"
        }
      ]
    }
  }
}

Warning

This policy does not cover attach-instance-to-subnet and detach-instance-from-subnet, which belong to the compute service class. To apply the same restriction to them, add equivalent rules to the compute service policy.

Last updated on