S3 · Data

S3Bucket

Manage S3 buckets, encryption, versioning, ACLs, and tags.

Generic driverUniform lifecycle
Scope
Global
Spec fields
5
Outputs
4
Lookup
Supported

Resource definition

What this resource looks like

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

CUE example
resources: archive: {
  apiVersion: "praxis.io/alpha"
  kind: "S3Bucket"
  metadata: {name: "payments-prod-archive", labels: {}}
  spec: {
    region: "us-west-2"
    versioning: true
    encryption: {
      enabled: true
      algorithm: "AES256"
    }
    tags: environment: "prod"
  }
}

Desired state

Configuration

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

regionRequired

Region.

string
String
versioningOptional

Versioning.

bool | *true
BooleanDefault true
aclOptional

Acl.

"private" | "public-read" | *"private"
EnumDefault "private"
encryptionRequired

Encryption.

{ enabled: bool | *true algorithm: *"AES256" | "aws:kms" }
Object
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>}.

arnString
bucketNameString
regionString
domainNameString

Read without ownership

Data-source lookup

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

Understand data sources and filters →

Adopt existing infrastructure

Import

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

CLI
praxis import S3Bucket \
  --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/s3/s3.cue
package s3

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

	metadata: {
		// Bucket names must follow S3's naming rules:
		// 3-63 characters, lowercase letters, numbers, hyphens, periods.
		name: string & =~"^[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$"
		labels: [string]: string
	}

	spec: {
		region:     string
		versioning: bool | *true // default: enabled (best practice)
		acl:        "private" | "public-read" | *"private"
		encryption: {
			enabled:   bool | *true // default: enabled (AWS best practice since Jan 2023)
			algorithm: *"AES256" | "aws:kms"
		}
		tags: [string]: string
	}

	// Outputs are populated by the driver after provisioning.
	// These fields are referenced in output expressions by dependent resources.
	// Optional at template time — the driver fills them after Provision.
	outputs?: {
		arn:        string
		bucketName: string
		region:     string
		domainName: string
	}
}

View this schema on GitHub →