gce_make_firewall_rule: Add one firewall rule to the network

Description Usage Arguments Value sourceRanges and/or sourceTags See Also Examples

View source: R/firewalls.R

Description

Use this to create firewall rules to apply to the network settings. Most commonly this is to setup web access (port 80 and 443)

Usage

1
2
3
4
5
6
7
8
gce_make_firewall_rule(
  name,
  protocol,
  ports,
  sourceRanges = NULL,
  sourceTags = NULL,
  project = gce_get_global_project()
)

Arguments

name

Name of the firewall rule

protocol

Protocol such as tcp, udp, icmp, esp, ah, sctp or IP protocol number.

ports

Port numbers to open

sourceRanges

From where to accept connections. If NULL then will default to 0.0.0.0/0 (everywhere)

sourceTags

A list of instance tags this rule applies to. One or both of sourceRanges and sourceTags may be set.

project

The Google Cloud project

Value

A global operation object

sourceRanges and/or sourceTags

If both properties are set, an inbound connection is allowed if the range or the tag of the source matches the sourceRanges OR matches the sourceTags property; the connection does not need to match both properties.

See Also

API Documentation https://cloud.google.com/compute/docs/reference/latest/firewalls/insert

Other firewall functions: gce_delete_firewall_rule(), gce_get_firewall_rule(), gce_list_firewall_rules(), gce_make_firewall_webports()

Examples

1
2
3
4
5
6
7
8
## Not run: 

  gce_make_firewall_rule("allow-http", protocol = "tcp", ports = 80)
  gce_make_firewall_rule("allow-https", protocol = "tcp", ports = 443)
  gce_make_firewall_rule("shiny", protocol = "tcp", ports = 3838)
  gce_make_firewall_rule("rstudio", protocol = "tcp", ports = 8787)

## End(Not run)

cloudyr/googleComputeEngineR documentation built on Jan. 23, 2022, 8:30 a.m.