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.
The resource
Section titled “The resource”An S3 bucket, described as data. It synthesizes to CloudFormation:
export const bucket = new Bucket({ BucketName: "chant-trio-bucket", PublicAccessBlockConfiguration: { BlockPublicAcls: true, BlockPublicPolicy: true, IgnorePublicAcls: true, RestrictPublicBuckets: true, },});The op
Section titled “The op”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.
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()]), ],});How awsApply works
Section titled “How awsApply works”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
DescribeStacksto decide create vs update. CreateStackorUpdateStackwith the template body and capabilities. A no-op update (real AWS’s “No updates are to be performed”) is treated as unchanged.- Polls
DescribeStacksuntil the stack settles —CREATE_COMPLETE/UPDATE_COMPLETE— and fails the phase on a*_FAILED/ROLLBACKstate.
The stack is the deploy boundary, so deletes ride CloudFormation itself — awsDelete calls DeleteStack and polls until the stack is gone. No separate prune.
Run it
Section titled “Run it”Requires Docker.
cd examples/local-cloud-trionpm installchant run awsFrom local to real cloud
Section titled “From local to real cloud”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.