agentleFS
ambroselittleambroselittle/agent-skills/skills/deploy-aws/SKILL.md

deploy-aws

Skill0 starsChanged 2 months agoMITView on GitHub

Deploy a project to AWS using App Runner (containers) + RDS (Postgres). Detects Dockerfiles, provisions infra, builds and pushes images, deploys services, and prints live URLs. Optimized for agent-skills templates but works on any repo with Dockerfiles.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

21 rules. About 0 are common, 14 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈14

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If $ARGUMENTS is cleanup:

    line 26
  2. Distinctive:

    If the AWS auth pre-loaded context shows an error or is empty:

    line 40
  3. Distinctive:

    Stop here until auth is confirmed.

    line 44
  4. Very specific:

    If $ARGUMENTS includes update and .deploy-aws.json exists with a valid config:

    line 50
  5. Very specific:

    If .deploy-aws.json exists but update was not passed:

    line 54
  6. Distinctive:

    If yes: skip interview, jump to Step 4

    line 56
  7. Distinctive:

    If no: proceed with interview (may overwrite config)

    line 57
  8. Very specific:

    Use AskUserQuestion for every question.

    line 63
  9. Distinctive:

    Put the most common/default first

    line 70
  10. Distinctive:

    Default: deploy all services found: Do not ask unless there are 3 or more Dockerfiles — at that point it's worth confirming the user …

    line 93
  11. Distinctive:

    If 1–2 Dockerfiles found: skip this question, deploy all of them automatically.

    line 95
  12. Distinctive:

    If 3+ Dockerfiles found, ask one opt-out question:

    line 97
  13. Distinctive:

    If they choose "Skip some": follow up asking which to exclude (free text or another question)

    line 105
  14. Very specific:

    If "Use existing": ask for the DATABASE_URL as free text.

    line 117
  15. Distinctive:

    Ask: "Ready to deploy?" before proceeding.

    line 127
  16. Distinctive:

    Run the provision script. This is idempotent — safe to re-run.

    line 133
  17. Distinctive:

    If it fails: read the error, diagnose (common issues: region not enabled, service limits, insufficient permissions), fix or guide the user, …

    line 150
  18. Distinctive:

    Run these sequentially — Docker builds are CPU/memory intensive.

    line 163
  19. Distinctive:

    If a build fails: show the last 20 lines of output, diagnose the error (missing files, wrong context path, etc.), and ask the user how to …

    line 165
  20. Very specific:

    If deploying web after api: the script automatically reads the API's live URL from .deploy-aws.json and sets API_HOST accordingly.

    line 180
  21. Very specific:

    If any service URL is for the web app, open it: open <url>.

    line 200

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Deploy to AWS

You are a deployment assistant. Your job is to get this project running on AWS with minimal friction — provisioning infra, building images, deploying services, and handing back live URLs.

Arguments: $ARGUMENTS

  • update — skip interview, re-deploy using existing .deploy-aws.json config
  • cleanup — tear down all provisioned AWS resources and delete .deploy-aws.json

Pre-loaded context:

  • AWS auth: !~/.claude/skills/deploy-aws/scripts/context.sh auth-status
  • Dockerfiles found: !~/.claude/skills/deploy-aws/scripts/context.sh dockerfiles
  • Existing deploy config: !~/.claude/skills/deploy-aws/scripts/context.sh deploy-config
  • Repo template type: !~/.claude/skills/deploy-aws/scripts/context.sh template-type

Step 0: Cleanup (early exit)

If $ARGUMENTS is cleanup:

  1. Confirm with the user: "This will delete all AWS resources for the app in .deploy-aws.json (App Runner services, ECR repos, RDS instance, security group, IAM role). This cannot be undone. Proceed?"
  2. If confirmed, run:
    uv run --project ~/.claude/skills/deploy-aws python ~/.claude/skills/deploy-aws/scripts/cleanup.py
    Pass --keep-config if the user says they want to keep .deploy-aws.json.
  3. Print the script output and stop — do not proceed to any other steps.

Step 1: Auth Check

If the AWS auth pre-loaded context shows an error or is empty:

"AWS CLI isn't authenticated. Run aws login in your terminal (it opens a browser), then retry."

Stop here until auth is confirmed.


Step 2: Assess State

If $ARGUMENTS includes update and .deploy-aws.json exists with a valid config:

  • Skip the interview entirely
  • Jump to Step 4 (build + push)

If .deploy-aws.json exists but update was not passed:

  • Tell the user: "Found existing deploy config for <app> in <region>. This will update the running services. Proceed?"
  • If yes: skip interview, jump to Step 4
  • If no: proceed with interview (may overwrite config)

Step 3: Interview

Use AskUserQuestion for every question. Batch independent questions in one call (max 4 per call).

AskUserQuestion constraints:

  • questions: array of 1–4 question objects
  • Each: question (string), header (max 12 chars), options (2–4 items), multiSelect (boolean)
  • Each option: label (1–5 words), description
  • Tool auto-adds "Other" for free text — don't add it yourself
  • Put the most common/default first

Batch 1 — App basics

Ask these together:

Question 1 — App name:

  • header: "App Name"
  • question: "What should this deployment be called? (used for ECR repos, App Runner service names, and RDS identifier)"
  • options (always provide exactly 2):
    • label: derived from repo directory name (e.g. "test-graphql"), description: "Derived from repo name — recommended"
    • label: derived name + -app suffix (e.g. "test-graphql-app"), description: "Alternate slug if the base name is taken in AWS"

Question 2 — AWS region:

  • header: "Region"
  • question: "Which AWS region?"
  • options:
    • "us-east-1" — US East (N. Virginia) — lowest latency to most US users, most services available
    • "us-west-2" — US West (Oregon) — good US West Coast latency
    • "eu-west-1" — EU (Ireland) — EU users

Batch 2 — Services (only if 3+ Dockerfiles found)

Default: deploy all services found. Do not ask unless there are 3 or more Dockerfiles — at that point it's worth confirming the user doesn't want to skip any.

If 1–2 Dockerfiles found: skip this question, deploy all of them automatically.

If 3+ Dockerfiles found, ask one opt-out question:

Question — Skip any services?:

  • header: "Skip Any?"
  • question: "Found N services (list them). Deploy all of them?"
  • options:
    • "Deploy all" — deploy everything found (default)
    • "Skip some" — I'll tell you which ones to leave out
  • If they choose "Skip some": follow up asking which to exclude (free text or another question)

Batch 3 — Database

Question — Database:

  • header: "Database"
  • question: "Does this app need a Postgres database on RDS?"
  • options:
    • "Yes, create RDS" — Provision a free-tier RDS Postgres instance (db.t3.micro)
    • "No database" — Skip RDS (app uses an external DB or none)
    • "Use existing" — I'll provide a DATABASE_URL

If "Use existing": ask for the DATABASE_URL as free text.

Confirm

Summarize the plan:

  • App name, region
  • Services to deploy (with Dockerfile paths)
  • Database choice
  • Estimated AWS costs (App Runner: ~$0–5/mo on free tier; RDS free tier: $0 for 12 months)

Ask: "Ready to deploy?" before proceeding.


Step 4: Provision Infrastructure

Run the provision script. This is idempotent — safe to re-run.

uv run --project ~/.claude/skills/deploy-aws python ~/.claude/skills/deploy-aws/scripts/provision.py \
  --app <app-name> \
  --region <region> \
  --services <comma-separated service names, e.g. "api,web"> \
  --db <"rds"|"external:<DATABASE_URL>"|"none">

This creates:

  • ECR repository for each service
  • IAM role for App Runner to pull from ECR
  • RDS Postgres instance + security group (if --db rds)

It saves state to .deploy-aws.json in the current directory and prints a summary.

If it fails: read the error, diagnose (common issues: region not enabled, service limits, insufficient permissions), fix or guide the user, then retry once.


Step 5: Build and Push Images

For each service being deployed, build its Docker image and push to ECR.

uv run --project ~/.claude/skills/deploy-aws python ~/.claude/skills/deploy-aws/scripts/build-push.py \
  --service <service-name>

Run these sequentially — Docker builds are CPU/memory intensive. Show progress as each service builds.

If a build fails: show the last 20 lines of output, diagnose the error (missing files, wrong context path, etc.), and ask the user how to proceed.


Step 6: Deploy Services

Deploy each service to App Runner. For fullstack apps, always deploy API before web (web needs the API's live URL for API_HOST).

uv run --project ~/.claude/skills/deploy-aws python ~/.claude/skills/deploy-aws/scripts/deploy.py \
  --service <service-name>

The script waits for the service to reach RUNNING state (polls every 10s, times out at 5 min).

If deploying web after api: the script automatically reads the API's live URL from .deploy-aws.json and sets API_HOST accordingly.


Step 7: Done

Print a clean summary:

Deployed successfully!

Services:
  api  → https://<id>.us-east-1.awsapprunner.com
  web  → https://<id>.us-east-1.awsapprunner.com

Database: <endpoint>:5432/<db-name>  (RDS free tier — remember to delete when done)

Config saved to .deploy-aws.json — run /deploy-aws update to redeploy.

If any service URL is for the web app, open it: open <url>.


Guidelines

  • Always provision before build — ECR repos must exist before pushing images.
  • API before web — web's API_HOST env var needs the API's live URL.
  • Idempotency — all scripts are safe to re-run. Re-running provision won't duplicate resources.
  • Free tier — remind the user to tear everything down when done if they don't need it long-term. Say: "Run /deploy-aws cleanup to remove all provisioned resources."
  • Secrets — never log or print DATABASE_URL or passwords to the terminal. The scripts handle this.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.