Skip to content

Local Testing — AWS (Floci)

AWS keeps CloudFormation as its native format. awsApply deploys the built template by calling the CloudFormation API directly — create-or-update the stack, then poll it to a settled state — against Floci’s emulated control plane or real AWS by endpoint override. It’s the direct twin of azApply and gcpApply: it speaks the API over HTTP rather than shelling aws cloudformation deploy.

An S3 bucket, described as data. It synthesizes to CloudFormation:

src/aws/infra.ts
export const bucket = new Bucket({
BucketName: "chant-trio-bucket",
PublicAccessBlockConfiguration: {
BlockPublicAcls: true,
BlockPublicPolicy: true,
IgnorePublicAcls: true,
RestrictPublicBuckets: true,
},
});

chant run aws boots Floci, builds the stack, applies it with awsApply, verifies the bucket over the S3 API, and tears the emulator down. Every phase is a modeled activity — no raw shell.

ops/aws.op.ts
export default Op({
name: "aws",
taskQueue: "trio-aws",
phases: [
phase("Emulator", [flociUp({ dockerSocket: true })]),
phase("Build", [build(".", { script: "build:aws" })]),
phase("Apply", [awsApply("dist/aws.json", { stackName: "trio-aws", endpoint: "http://localhost:4566" })]),
phase("Verify", [httpCheck("http://localhost:4566/chant-trio-bucket")]),
phase("Teardown", [flociDown()]),
],
});

CloudFormation is a control plane: you submit a template to a named stack and it reconciles. awsApply drives that plane through its API, no CLI in between:

  • Reads the built template and calls DescribeStacks to decide create vs update.
  • CreateStack or UpdateStack with the template body and capabilities. A no-op update (real AWS’s “No updates are to be performed”) is treated as unchanged.
  • Polls DescribeStacks until the stack settles — CREATE_COMPLETE / UPDATE_COMPLETE — and fails the phase on a *_FAILED / ROLLBACK state.

The stack is the deploy boundary, so deletes ride CloudFormation itself — awsDelete calls DeleteStack and polls until the stack is gone. No separate prune.

Requires Docker.

Terminal window
cd examples/local-cloud-trio
npm install
chant run aws

Drop the endpoint override and awsApply targets real CloudFormation. The template, the create-or-update logic, and the settle-polling are unchanged — only the API host differs.