Lambda · Compute

LambdaFunction

Manage Lambda code, runtime configuration, roles, and networking.

Generic driverUniform lifecycle
Scope
Regional
Spec fields
17
Outputs
7
Lookup
Supported

Resource definition

What this resource looks like

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

CUE example
resources: processor: {
  apiVersion: "praxis.io/alpha"
  kind: "LambdaFunction"
  metadata: {name: "payments-processor", labels: {}}
  spec: {
    region: "us-west-2"
    role: "${resources.functionRole.outputs.arn}"
    runtime: "provided.al2023"
    handler: "bootstrap"
    code: s3: {
      bucket: "release-artifacts"
      key: "payments/processor.zip"
    }
    tags: environment: "prod"
  }
}
Complete examples in the repository

Desired state

Configuration

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

regionRequired

Region.

string
String
roleRequired

Role.

string
String
packageTypeOptional

Package Type.

"Zip" | "Image"
Enum
runtimeOptional

Runtime.

string
String
handlerOptional

Handler.

string
String
descriptionOptional

Description.

string
String
codeRequired

Code.

{ s3?: { bucket: string key: string objectVersion?: string } zipFile?: string & =~"^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$" imageUri?: string }
Object
memorySizeOptional

Memory Size.

int & >=128 & <=10240
Integer
timeoutOptional

Timeout.

int & >=1 & <=900
Integer
environmentOptional

Environment.

[string]: string
Map
layersOptional

Layers.

[...string]
List
vpcConfigOptional

Vpc Config.

{ subnetIds?: [...string] securityGroupIds?: [...string] }
Object
deadLetterConfigOptional

Dead Letter Config.

targetArn: string
Object
tracingConfigOptional

Tracing Config.

mode: "Active" | "PassThrough"
Object
architecturesOptional

Architectures.

[...("x86_64" | "arm64")]
List
ephemeralStorageOptional

Ephemeral Storage.

size: int & >=512 & <=10240
Object
tagsOptional

Tags.

[string]: string
Map

Observed values

Outputs

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

functionArnString
functionNameString
versionString · optional
stateString · optional
lastModifiedString · optional
lastUpdateStatusString · optional
codeSha256String · optional

Read without ownership

Data-source lookup

A data block reads an existing LambdaFunction 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: "LambdaFunction"
  region: "us-west-2"
  filter: {
    name: "replace-with-provider-name"
  }
}
Documented selectorsidnameid/name + tag

Understand data sources and filters →

Adopt existing infrastructure

Import

Import persists Praxis state for an existing AWS resource. For this kind, supply: Function name and region. The example starts in observed mode so Praxis reports drift without correcting it.

CLI
praxis import LambdaFunction \
  --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/lambda/function.cue
package lambda

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

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

	spec: {
		region:       string
		role:         string
		packageType?: "Zip" | "Image"
		runtime?:     string
		handler?:     string
		description?: string
		code: {
			s3?: {
				bucket:         string
				key:            string
				objectVersion?: string
			}
			// zipFile must be a base64-encoded deployment package.
			zipFile?:  string & =~"^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$"
			imageUri?: string
		}
		memorySize?: int & >=128 & <=10240
		timeout?:    int & >=1 & <=900
		environment?: [string]: string
		layers?: [...string]
		vpcConfig?: {
			subnetIds?: [...string]
			securityGroupIds?: [...string]
		}
		deadLetterConfig?: targetArn: string
		tracingConfig?: mode: "Active" | "PassThrough"
		architectures?: [...("x86_64" | "arm64")]
		ephemeralStorage?: size: int & >=512 & <=10240
		tags?: [string]:         string
	}

	outputs?: {
		functionArn:       string
		functionName:      string
		version?:          string
		state?:            string
		lastModified?:     string
		lastUpdateStatus?: string
		codeSha256?:       string
	}
}

View this schema on GitHub →