Elastic Load Balancing · Networking

NLB

Manage Network Load Balancers and network placement.

Generic driverUniform lifecycle
Scope
Regional
Spec fields
10
Outputs
5
Lookup
Supported

Resource definition

What this resource looks like

This is the CUE shape a Praxis template uses to declare a NLB. The resource key is local to the template; metadata.name supplies its stable Praxis identity.

CUE example
resources: {
  nlb: {
  	apiVersion: "praxis.io/alpha"
  	kind:       "NLB"
  	metadata: name: "\(_naming.prefix)-nlb"
  	spec: {
  		region: _naming.region
  		name:   "\(_naming.prefix)-nlb"
  		scheme: "internal"
  		subnets: [
  			"${resources.appSubnetA.outputs.subnetId}",
  			"${resources.appSubnetB.outputs.subnetId}",
  		]
  		crossZoneLoadBalancing: true
  		tags: #AppTags
  	}
  }
}

Excerpted from examples/stacks/end-to-end.cue. Open the complete example for its variables and related resources.

Complete examples in the repository

Desired state

Configuration

The spec block accepts 10 fields. 4 are required by the schema; fields with defaults can be omitted.

regionRequired

Region.

string
String
accountOptional

Account.

string
String
nameRequired

Name.

string & =~"^[a-zA-Z0-9]([a-zA-Z0-9-]{0,30}[a-zA-Z0-9])?$"
String
schemeRequired

Scheme.

"internet-facing" | "internal"
Enum
ipAddressTypeOptional

Ip Address Type.

"ipv4" | "dualstack" | *"ipv4"
EnumDefault "ipv4"
subnetsOptional

Subnets.

[...string]
List
subnetMappingsOptional

Subnet Mappings.

[...#NLBSubnetMapping]
List
crossZoneLoadBalancingOptional

Cross Zone Load Balancing.

bool | *false
BooleanDefault false
deletionProtectionOptional

Deletion Protection.

bool | *false
BooleanDefault false
tagsRequired

Tags.

[string]: string
Map

Observed values

Outputs

Praxis records these values after observation. A dependent resource can read one with ${resources.<name>.outputs.<field>}.

loadBalancerArnString
dnsNameString
hostedZoneIdString
vpcIdString
canonicalHostedZoneIdString

Read without ownership

Data-source lookup

A data block reads an existing NLB and exposes its outputs without storing lifecycle state. The generic filter surface accepts id, name, and tag; supported combinations depend on the AWS identity used by this resource.

CUE data source
data: existing: {
  kind: "NLB"
  region: "us-west-2"
  filter: {
    name: "replace-with-provider-name"
  }
}

Understand data sources and filters →

Adopt existing infrastructure

Import

Import persists Praxis state for an existing AWS resource. For this kind, supply: Provider identifier for the existing NLB. The example starts in observed mode so Praxis reports drift without correcting it.

CLI
praxis import NLB \
  --id <provider-identifier> \
  --region us-west-2 \
  --account production \
  --observe

Choose managed or observed ownership →

Canonical contract

Complete CUE schema

The field guide above is derived from this definition. The schema remains the source of truth for accepted values, defaults, validation constraints, and outputs in the current alpha revision.

Show the complete schema
schemas/aws/elb/nlb.cue
package elb

#NLB: {
	apiVersion: "praxis.io/alpha"
	kind:       "NLB"

	metadata: {
		name: string & =~"^[a-zA-Z0-9]([a-zA-Z0-9-]{0,30}[a-zA-Z0-9])?$"
		labels: [string]: string
	}

	spec: {
		region:        string
		account?:      string
		name:          string & =~"^[a-zA-Z0-9]([a-zA-Z0-9-]{0,30}[a-zA-Z0-9])?$"
		scheme:        "internet-facing" | "internal"
		ipAddressType: "ipv4" | "dualstack" | *"ipv4"
		subnets?: [...string]
		subnetMappings?: [...#NLBSubnetMapping]
		crossZoneLoadBalancing: bool | *false
		deletionProtection:     bool | *false
		tags: [string]: string
	}

	outputs?: {
		loadBalancerArn:       string
		dnsName:               string
		hostedZoneId:          string
		vpcId:                 string
		canonicalHostedZoneId: string
	}
}

#NLBSubnetMapping: {
	subnetId:      string
	allocationId?: string
}

View this schema on GitHub →