Cloud.Network
A Better Stack Cloud private network. Servers attached to it get private addresses from its IP range and reach each other without the public internet. Networks are free.
Only name can change in place: ipPrefix, ipPrefixLength, teamId
and availabilityZone replace the network.
Ownership. The API keeps no metadata for it, so the generated name (it ends
in the resource instance’s random suffix) is what identifies an object this stack
created: a create interrupted before its state was saved is found by that name on
the next deploy. An explicitly named object can’t be told apart from someone
else’s (it is taken over only with --adopt), and list returns every object.
Creating a network
Section titled “Creating a network”A /24 private network
const network = yield* BetterStack.Cloud.Network("private", { ipPrefix: "10.0.0.0", ipPrefixLength: 24,});Named, in a specific zone
yield* BetterStack.Cloud.Network("backend", { name: "backend", ipPrefix: "10.1.0.0", ipPrefixLength: 16, availabilityZone: "us-west-2a",});Looking up an existing network
Section titled “Looking up an existing network”Reference a network by id
const existing = BetterStack.Cloud.Network.lookup({ id: "42" });ipPrefix string required
The IPv4 or IPv6 address the network's range starts at, such as 10.0.0.0.
ipPrefixLength number required
The prefix length of the network's range, such as 24 for an IPv4 range of 256 addresses. Accepts 0 to 128, and must fit the address family of ip_prefix.
availabilityZone string
Picks the host the call goes to (the {availability_zone} of https://{availability_zone}.betterstackcloud.com); never sent as a parameter. Defaults to the credentials' value. The zone the resources are in, such as us-west-2a (the Terraform provider's availability_zone setting, or BETTERSTACK_AVAILABILITY_ZONE). Each zone is separate. The sources list no enumeration of zones; the default is the example the Terraform provider and the Cloud API docs use.
name string
The network's name. Defaults to a unique name generated from the stack, stage and logical id.
teamId string
Team that owns the resource, such as t123. Defaults to the credentials' team (BETTERSTACK_TEAM_ID, or the profile's team). Changing it replaces the resource.
Attributes
Section titled “Attributes”availabilityZone string always set
Availability zone the resource lives in, such as us-west-2a.
id string always set
The network's ID.
createdAt string
When the network was created.
ipPrefix string
The IPv4 or IPv6 address the network's range starts at, such as 10.0.0.0.
ipPrefixLength number
The prefix length of the network's range, such as 24 for an IPv4 range of 256 addresses. Accepts 0 to 128, and must fit the address family of ip_prefix.
name string
The network's name.
teamId string
The ID of the team that owns the network. betterstack team list shows it.
updatedAt string
When the network was last updated.
Lookup
Section titled “Lookup”Network.lookup(props) reads an object this stack does not manage. It is never created, updated or deleted.
id string required
The network's ID.
availabilityZone string
Zone it lives in, such as us-west-2a. Defaults to the credentials' zone.