
Weekend Deployment Challenge: AWS CloudCLI
Learn AWS CLI with AI: generate commands, understand every part, safely execute read-only operations, and practice with interactive challenges.
Series: Weekend Challenge (3 articles)
- 1Weekend Deployment Challenge: AWS CloudCLI This article
What the application does
AWS CloudCLI is an interactive AWS CLI learning tool. You choose a service,
describe your goal in plain English, and Amazon Bedrock generates the correct
AWS CLI command. Crucially, it doesn't stop at the command it explains the
command, breaks down every token, names the AWS concept, labels the risk, and
lets you safely run read-only commands. A Learning Mode adds guided challenges.
Ask. Understand. Execute. Learn AWS.
Working application URL
Why I built it
AI can generate CLI commands, but beginners often run commands they don't
understand sometimes destructive ones, sometimes straight from an LLM into a
shell. I wanted a tool that teaches while it generates, and that makes unsafe
execution impossible by design.
Development process (BUILD → TEST → DEPLOY → DOCUMENT)
Built in the phased order recommended by the challenge:
- Phase 1 - React (Vite) frontend with mocked AI, so the full UX worked before any cloud resources existed. Deployable immediately.
- Phase 2 - Backend scaffolding: AWS SAM template, API Gateway, two Lambdas.
- Phase 3 - Amazon Bedrock integration in the
generateLambda.
- Phase 4 & 5 - The command safety layer + restricted execution Lambda.
- Phase 6 - Deployment config (Amplify + SAM).
- Phase 7 - Testing (unit suites + manual E2E checklist).
The app stayed deployable after every phase.
Technical decisions
- Vite + React over CRA: faster builds, smaller output, current standard.
- Two Lambdas, not one. The
executeLambda never sees raw model output; it only accepts a string that must pass the allowlist. Separation of concerns = smaller blast radius.
- AWS SDK, not shell. Instead of shelling out to
aws, each allowlisted command maps to a fixed SDK call. This makes shell injection structurally ** impossible, not just filtered.
- Single source-of-truth validator in
shared/, synced into the Lambda bundle. Same logic runs in the browser (mock), the backend, and the tests.
- esbuild bundling for Lambda with
@aws-sdk/*marked external (the SDK ships in thenodejs24.xruntime) tiny 5.7 KB bundles.
- Least-privilege IAM scoped to exactly the actions used.
Problems encountered & how I solved them
-
nodejs20.xruntime was deprecated. SAM lint flagged it (disabled for creation as of mid-2026). Fix: moved both functions tonodejs24.x.
-
sam buildfailed on Windows withWinError 3(MAX_PATH). The deep@aws-sdkdependency tree exceeded Windows' 260-char path limit when SAM copiednode_modules. Fix: switched to the esbuild build method and marked@aws-sdk/*as external + moved those packages todevDependencies(they exist in the Lambda runtime). Bundles dropped to a few KB and the copy step no longer touches the SDK tree.
- esbuild not found by SAM. Fix: run builds via
npm run build, which putsnode_modules/.binon PATH so SAM's esbuild builder resolves it.
- Trusting AI output. Fix: the model's command is re-validated against the allowlist independently before any execute decision.
- Bedrock model access blocked by billing. My first choice, Claude 3 Haiku,
failed at invoke time with
INVALID_PAYMENT_INSTRUMENTbecause the account had no valid payment method for the AWS Marketplace subscription.
- Fix:
switched to Amazon Nova Lite, an AWS-native Bedrock model that needs no
Marketplace subscription. This also meant adapting the request/response
schema Nova uses a
system+messages[].content[].textshape and returnsoutput.message.content[0].text, unlike Claude'smessages/contentformat.
- The model kept suggesting off-allowlist equivalents. Nova often returned
aws s3api list-bucketsinstead ofaws s3 ls- both read-only and correct, but only one was allowlisted, so Execute was disabled.
- Fix: added the read-only equivalent to the allowlist (with its own SDK executor) so the demo flows, without weakening the security model.
AWS architecture

AWS services used
Amplify Hosting, API Gateway, Lambda, Bedrock, IAM, CloudFormation/SAM, and the
read-only targets S3 / EC2 / DynamoDB / STS. (See README table in GitHub link.)
Deployment process
- Backend:
cd backend && npm run deploy:guided→ note theApiBaseUrloutput.
- Frontend: connect the repo in Amplify (auto-detects
amplify.yml), setVITE_API_BASE_URLto the API base URL, deploy.
- Lock CORS to the Amplify origin by redeploying the backend with
CorsOrigin.
What I learned
- How to place a safety/validation boundary between an LLM and any execution.
- Designing execution so injection is impossible by construction (SDK vs shell).
- Least-privilege IAM in practice with SAM policy templates.
- Real-world packaging gotchas (runtime deprecation, Windows path limits, bundler externals) - and how to diagnose them from build logs.
Pricing
CloudCLI is deliberately serverless and pay-per-use, so there's nothing
running (or billing) while it sits idle. For the weekend challenge and light
personal use it stays within or very close to the AWS Free Tier.
Service | How you're charged | Demo-scale cost |
|---|---|---|
Amazon Bedrock (Nova Lite) | Per 1K input/output tokens | A few cents for hundreds of generations |
AWS Lambda | Per request + GB-seconds (generous free tier) | ~$0 |
Amazon API Gateway (REST) | ~$3.50 / million requests | ~$0 |
AWS Amplify Hosting | Build minutes + data served/stored | Cents/month for a static SPA |
Amazon S3 (SAM deploy bucket) | Storage + requests | Negligible |
CloudWatch Logs | Log ingestion + storage | Negligible |
Estimated total: typically under $1/month at demo scale, dominated by
Bedrock token usage which only grows with how many commands you generate.
Because execution is read-only, there are no surprise costs from spinning up
compute or storage on the target services.
Tip for the article: mention setting an AWS Budgets alert (e.g. $5) as a
safety net good practice to show, and a nice "responsible builder" detail.
Conclusion
AWS CloudCLI set out to solve a specific problem: people can already generate
AWS CLI commands with AI, but they often run commands they don't understand or
paste raw model output straight into a shell. CloudCLI closes that gap by pairing
generation with teaching and putting a strict safety layer between the AI
and any execution.
What I'm most proud of is the security design. Instead of filtering shell input,
the execute path never uses a shell at all each allowlisted, read-only command
maps to a fixed AWS SDK call, so command injection is impossible by
construction, not just blocked by a regex. The AI's output is always
re-validated against an explicit allowlist before anything runs, and no
credentials ever touch the browser.
The build followed a clean arc - BUILD → TEST → DEPLOY → DOCUMENT - and
stayed deployable at every phase, starting from a fully mocked frontend. Along
the way I hit real-world issues (a deprecated Lambda runtime, Windows path
limits during bundling, and a Bedrock billing block that pushed me from Claude to
Amazon Nova) and solved each one exactly the kind of hands-on learning this
challenge is about.
The result is a small but genuinely useful app: 21 AWS services in the dropdown,
five with live read-only execution, an interactive quiz to build CLI knowledge,
and a documented, least-privilege, serverless architecture that costs pennies to
run. If I take it further, the next steps are Cognito auth, per-user IAM scoping,
command history in DynamoDB, and a CI pipeline.
Built with React, AWS Amplify, API Gateway, AWS Lambda, and Amazon Bedrock.
Author By DD.
Thank you for taking the time to read my article! If you found it helpful, feel free to like, share, and drop your thoughts in the comments; I’d love to hear from you.
If you want to connect or dive deeper into cloud, AI and DevOps, feel free to follow me on my socials:
Series: Weekend Challenge (3 articles)
- 1Weekend Deployment Challenge: AWS CloudCLI This article
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article