
Setup · Your cloud on your laptop
Floci, locally or in a Codespace
🎯 What you get
- A full AWS-like cloud on
http://localhost:4566: IAM, S3, EC2, VPC, ELB, ECS, ECR, RDS, Lambda, CloudWatch, SNS, SQS, CloudFront, CloudFormation and more. - Real enforcement where it matters: IAM policies are checked (you'll see real
AccessDenied), security groups really filter traffic between your containers. - Real things behind the API: an EC2 instance is a real Linux container, RDS is a real PostgreSQL, ECS runs your real image.
🧭 Pick your way in
Way A, your laptop (recommended if Docker works on it)
- Install Docker Desktop (Mac, Windows) or Docker Engine (Linux, your user in the
dockergroup). Rootless Docker is not supported. - Install the AWS CLI v2 and git.
- On Windows: use PowerShell for everything, with Git for Windows and the AWS CLI
.msiinstaller. The course gives you a PowerShell version of every command and every script (env.ps1,doctor.ps1,check.ps1...), look for the 🪟 Windows tab. - On a Mac, paste this first, so your terminal accepts commands with comments:
setopt interactive_comments sh_word_split. After that,source env.shdoes it for you. - Get the starter (next section), then in its folder:
# Start Floci (the first time pulls about 100 MB)
docker compose up -d
# Point the AWS CLI at Floci, in every new terminal
source env.sh
# Check your setup, everything should say OK
./doctor.sh# Allow the starter's scripts to run (once per machine)
Set-ExecutionPolicy -Scope CurrentUser RemoteSigned -Force
# Start Floci (the first time pulls about 100 MB)
docker compose up -d
# Point the AWS CLI at Floci, in every new PowerShell window
. .\env.ps1
# Check your setup, everything should say OK
.\doctor.ps1Way B, a GitHub Codespace (a Linux machine in your browser, free with your GitHub account)
- Open your group repo on GitHub → Code → Codespaces → Create codespace on main.
- Wait for VS Code to open. Floci starts by itself, Docker can take a minute after the codespace wakes up.
- In the terminal:
source env.sh && ./doctor.sh. - Stop the codespace when you leave (it auto-stops after 30 min idle). The free plan gives about 60 hours a month on 2 cores, plenty for this course.
📦 Get the starter into your group repo
One member does this once, then the others clone the group repo.
# Get the course repo, it holds the starter
git clone https://github.com/ricoleabricot/puff.git /tmp/puff
# Copy the starter into a new folder for your group
mkdir my-group
cp -r /tmp/puff/starter/. my-group/
cd my-group
# Make it a Git repo
git init -b main
git add .
git commit -m "Puff starter"
# Create an empty repo on GitHub (private is fine), then push to it
git remote add origin https://github.com/<you>/<repo>.git
git push -u origin main# Get the course repo, it holds the starter
git clone https://github.com/ricoleabricot/puff.git $env:TEMP\puff
# Copy the starter into a new folder for your group
New-Item -ItemType Directory my-group | Out-Null
Copy-Item -Recurse -Force $env:TEMP\puff\starter\* my-group\
Copy-Item -Force $env:TEMP\puff\starter\.gitignore my-group\
Copy-Item -Recurse -Force $env:TEMP\puff\starter\.devcontainer my-group\
Set-Location my-group
# Make it a Git repo
git init -b main
git add .
git commit -m "Puff starter"
# Create an empty repo on GitHub (private is fine), then push to it
git remote add origin https://github.com/<you>/<repo>.git
git push -u origin mainThen everyone sets the group id once per terminal, it prefixes every resource name:
# Your group number, two digits
export GROUP=g07# Your group number, two digits
$env:GROUP = "g07"🗂️ What's in the starter
| File | What it's for |
|---|---|
docker-compose.yml | Floci 2.5.0 with IAM and security group enforcement, don't change it |
env.sh | source env.sh in every new terminal |
doctor.sh | checks your setup |
infra/deploy.sh | your group's infra, every command in order, so anyone can rebuild it |
checks/check.sh | milestone checks, ./checks/check.sh M1 |
NOTES.md | your decisions with one line of why, it becomes your pitch |
wipe.sh | deletes all your local AWS resources, keeps your code |
🧪 Your first commands
# Who am I? Account 000000000000, that's Floci
aws sts get-caller-identity
# How many regions does this "AWS" have?
aws ec2 describe-regions --query 'length(Regions)'
# A first bucket, then list your buckets
aws s3api create-bucket --bucket $GROUP-hello
aws s3 ls# Who am I? Account 000000000000, that's Floci
aws sts get-caller-identity
# How many regions does this "AWS" have?
aws ec2 describe-regions --query 'length(Regions)'
# A first bucket, then list your buckets
aws s3api create-bucket --bucket "$env:GROUP-hello"
aws s3 ls👀 The Floci UI
After the commands, the milestones ask you to go look at what you built.
You get a hint first. Try it, then unfold 📸 to compare with the screenshot.
- Open the Floci UI launcher once each time you start Floci. It starts the UI and sends you to port 4500.
- After that, the link under each screenshot opens the same screen in your Floci.
It's a resource explorer, not the AWS console, so some steps have a 🆚 toggle with the real one. Look with the UI, build with commands: what you click isn't in your repo, so a rebuild loses it.
🔒 Close Floci to the network
Fix 1: go to your group folder, the one you run docker compose up -d from (change the path), with Docker running. The second command must find both (Windows: True twice). If it doesn't, you're in the wrong folder: stop and find the right one.
cd path/to/my-group
ls -d docker-compose.yml datacd path\to\my-group
Test-Path docker-compose.yml, dataFix 2: take the fixed file and restart. It downloads the file, removes the old UI container ("No such container" is fine) and restarts Floci on the same data.
curl -fsSL https://raw.githubusercontent.com/ricoleabricot/puff/main/starter/docker-compose.yml -o docker-compose.yml
docker rm -f floci-aws-ui
docker compose up -dcurl.exe -fsSL https://raw.githubusercontent.com/ricoleabricot/puff/main/starter/docker-compose.yml -o docker-compose.yml
docker rm -f floci-aws-ui
docker compose up -dFix 3: check. Wait 20 seconds, then paste the whole block. It lists any Floci port other machines can reach, you want CLOSED.
RUNNING=$(docker ps --format '{{.Names}} {{.Ports}}' | grep floci)
OPEN=$(echo "$RUNNING" | grep -E '0\.0\.0\.0:|\[::\]:')
if [ -z "$RUNNING" ]; then echo "NOT RUNNING: go back to fix 2"
elif [ -n "$OPEN" ]; then echo "STILL OPEN:"; echo "$OPEN"
else echo "CLOSED"; fi$RUNNING = @(docker ps --format '{{.Names}} {{.Ports}}' | Select-String 'floci')
$OPEN = @($RUNNING | Select-String '0\.0\.0\.0:|\[::\]:')
if ($RUNNING.Count -eq 0) { "NOT RUNNING: go back to fix 2" }
elseif ($OPEN.Count -gt 0) { "STILL OPEN:"; $OPEN | ForEach-Object { "$_" } }
else { "CLOSED" }CLOSED: you're safe, go to fix 5.STILL OPENwithi-followed by letters and digits in the name: a VM from course 2 is still running, do fix 4.STILL OPENwithflociorfloci-aws-ui: fix 2 ran in the wrong folder or the download failed, start again from fix 1.- Anything else: quit Docker and show me the output.
Fix 4: only if a VM is still open. It removes the course 2 VMs and nothing else: your app, database and data aren't touched.
for c in $(docker ps -aq --filter name='floci-aws-(ec2|ec2-fwd|sg)-i-'); do docker rm -f "$c"; donedocker ps -aq --filter 'name=floci-aws-(ec2|ec2-fwd|sg)-i-' | ForEach-Object { docker rm -f $_ }Then run fix 3 again, you want CLOSED.
Fix 5: one member only pushes the fixed file, so nobody gets the old one back from your repo.
git add docker-compose.yml
git commit -m "Close Floci to the network" -- docker-compose.yml
git pushgit add docker-compose.yml
git commit -m "Close Floci to the network" -- docker-compose.yml
git pushThe other members still do fixes 1 to 4 on their laptop, then take the pushed file:
git checkout -- docker-compose.yml
git pull
docker compose up -dgit checkout -- docker-compose.yml
git pull
docker compose up -d🧯 Linux, Codespaces, or something looks strange
- Linux:
docker version --format '{{.Server.Version}}'must be 28 or more. Older Docker Engines let machines on the same network reach127.0.0.1ports, so update it. - Codespace: it isn't on the room's Wi-Fi, but do the fix too so your repo has the right file, and keep every forwarded port Private.
- A container or an image in
docker ps -athat you don't recognize: quit Docker, don't delete it, show it to me.
🔍 Floci vs real AWS, what to keep in mind
| Topic | On Floci | On real AWS |
|---|---|---|
| Account, credentials | Account 000000000000, keys test/test are the admin | Your org's accounts, SSO, never long-lived admin keys |
| Container images | Push to localhost:5100/<repo>, it shows up in ECR | Push to <account>.dkr.ecr.<region>.amazonaws.com/<repo> |
| Network | Security groups filter traffic between containers. Routes, NAT and internet gateways exist in the API but don't route anything | Everything routes for real |
| Load balancer | Lives inside Floci, answers on http://<alb-dns>/ (port 80 of your machine) | Its own managed nodes in your subnets |
| Scaling | Nothing scales on its own. You'll build your own autoscaler with an alarm and a Lambda | Target tracking, scheduled actions |
| Not delivered, use an SQS queue as your pager | SNS emails, Slack, PagerDuty | |
| Cost | Free | Every hour counts, you'll price your stack in course 6 |
🧯 If it doesn't work
doctor.shsays Docker isn't running: start Docker Desktop. In a Codespace, wait a minute and retry.- Windows: "running scripts is disabled on this system": run
Set-ExecutionPolicy -Scope CurrentUser RemoteSignedonce, then reopen PowerShell. - Windows:
curlasks strange questions or prints an object: in PowerShell 5.1curlis a different command, always typecurl.exe. - Windows: an AWS command fails on a JSON argument: PowerShell 5.1 eats the quotes. The Windows tabs always put JSON in a file and pass
file://name.json, do the same. - Windows: a script runs but
check.ps1saysset GROUP first: set it in this window,$env:GROUP = "g07". - Mac:
command not found: #,parse error, or several subnets read as one: yourenv.shis from before November 23. In your group folder runcurl -fsSL https://raw.githubusercontent.com/ricoleabricot/puff/main/starter/env.sh -o env.sh && source env.sh, one member pushes it. - Port 80 or 4566 already in use: another Floci or web server is running,
docker psand stop it. - The CLI talks to real AWS or asks for a profile: you forgot
source env.sh(Windows:. .\env.ps1) in this terminal. docker pushfails with "HTTP response to HTTPS client": push to$REGISTRY/...(localhost:5100), not to the ECR URI.- Something is in a weird state:
./wipe.shthen rebuild with./infra/deploy.sh. That's exactly why the script exists. - Floci itself can be wrong sometimes, it's an emulator. If you're sure your command is right, ask me, a bug report counts as a good find.