C.W.K.
Stream
Lesson 05 of 06 · published

Cloud Workflows & GitHub Actions

~16 min · remote, cicd, github-actions, cloud, spot-instances

Level 0🌱 Novice
0 XP0/70 lessons0/11 achievements
0/120 XP to next level120 XP to go0% complete

Local prototype, cloud execution, no context loss

Remote shines in CI/CD by inverting the usual pattern. You don't push raw prompts to a CI runner; you prototype with full context locally, then hand off the established session to the runner. Heavy work runs where compute is cheap; thinking happens where iteration is fast.

The pattern: claude locally, iterate until the task is well-shaped, claude remote handoff ci-runner, the CI runner finishes the heavy task with the established context, results pulled back. Or fully unattended: cron + claude exec with --output-last-message.

Cost lever: use Spot/Preemptible VMs as Remote targets. Sessions can be handed back to local before preemption, so 60–90% cost savings come with no workflow disruption. Combine with Docker for reproducible target environments and you're at production-grade economics.

Code

Provision an EC2 Remote target·bash
aws ec2 run-instances \
  --image-id ami-0abcdef1234567890 \
  --instance-type c6i.2xlarge \
  --key-name my-key \
  --security-group-ids sg-0abc123 \
  --tag-specifications 'ResourceType=instance,Tags=[{Key=Purpose,Value=claude-remote}]' \
  --user-data '#!/bin/bash
    apt-get update -y
    curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
    apt-get install -y nodejs git
    npm install -g @anthropic-ai/claude-code
  '

# Add to SSH config
echo "
Host claude-ci
    HostName \$(aws ec2 describe-instances ...)
    User ubuntu
    IdentityFile ~/.ssh/my-key.pem
" >> ~/.ssh/config

claude remote add claude-ci
Overnight cron + Spot instance·bash
# crontab -e (on the always-on Remote target)
0 23 * * 1-5 /usr/local/bin/claude exec \
  --path /workspace/myproject \
  "Run full test suite, fix failures you can, update deps, \
   write a summary report." \
  --output-last-message \
  >> /var/log/claude-nightly.log 2>&1

# Or trigger from your local machine
claude remote handoff --resume claude-ci
# Walk away. Job runs on Spot. Comes back on local hand-back.

External links

Exercise

Provision a small cloud VM (free tier or cheapest Spot). Install Claude Code, configure SSH, register as a Remote target. Hand off a real handoff-worthy task (e.g., long test suite) and verify the savings on your local machine while it runs remote.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.