agentleFS
ericwood8ericwood8/skills/aws-lightsail-container-deploy/SKILL.md

aws-lightsail-container-deploy

Skill1 starsChanged 13 days agoMITView on GitHub

Use when running `aws lightsail` container-service commands, deploying or redeploying a multi-container app to Lightsail, editing a Lightsail containers.json or public-endpoint.json, or debugging a Lightsail container-service error. Trigger words - create-container-service-deployment, container name rejected, image version, pod networking, deployment stuck, Lightsail logs.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

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

    No per-container DNS: All containers in one deployment share a single network namespace (pod-style).

    line 40

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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

AWS Lightsail Container Service Deploy

Load this before writing any aws lightsail container-service command or touching containers.json — the API and runtime model here diverge from both plain ECS and Docker Compose in ways that produce confusing errors if you guess.

Quick start — the correct deploy sequence

# 1. Get the CURRENT highest version for every image — never assume/increment manually, never use ":latest"
aws lightsail get-container-images --service-name <service> --query "containerImages[].image"

# 2. Push a new image, note the printed version it lands on
aws lightsail push-container-image --service-name <service> --label <label> --image <local-image>:local

# 3. Update containers.json with the new numeric version for the image(s) that changed

# 4. Deploy — containers and publicEndpoint are SEPARATE flags, not one --cli-input-json payload
aws lightsail create-container-service-deployment \
  --service-name <service> \
  --containers file://containers.json \
  --public-endpoint file://public-endpoint.json

# 5. Poll the DEPLOYMENT state (not the service state) until ACTIVE
aws lightsail get-container-services --service-name <service> \
  --query "containerServices[0].currentDeployment.{version:version,state:state}"

# 6. On failure, pull real logs per-container rather than guessing
aws lightsail get-container-log --service-name <service> --container-name <name> --query "logEvents[-20:]"

Core rules

  1. Container names: hyphens only, no underscores — must match ^(?:[a-z0-9]{1,2}|[a-z0-9][a-z0-9-]+[a-z0-9])$.
  2. Image versions are numeric-only — there is no :latest/.LATEST. Always re-check get-container-images right before deploying.
  3. create-container-service-deployment takes --containers file://... and --public-endpoint file://... as separate parameters — never --cli-input-json with the container map as the whole payload.
  4. No per-container DNS. All containers in one deployment share a single network namespace (pod-style). Reach a sibling via localhost:<port>, never its container name — that only works in Docker Compose.
  5. Only one container per deployment can be public (publicEndpoint). Multiple logically-public services (SPA + API) need a reverse-proxy container (nginx) as the sole public endpoint, routing internally over localhost. Side effect: same-origin, so no CORS needed.
  6. No depends_on equivalent — containers start in parallel with no ordering guarantee. Anything that resolves a sibling hostname at startup (e.g. nginx proxy_pass) needs lazy/per-request resolution, not a literal target, or it can crash before a sibling is even up.
  7. Two different state fields: the container service's state (RUNNING while it serves a deployment, seen live) vs. an individual deployment's state (ACTIVATING → ACTIVE/FAILED, superseded ones go INACTIVE). A RUNNING service says nothing about the new deployment, so poll the deployment. ACTIVATING can legitimately sit for several minutes.
  8. No IaC path fits this well — it's CLI-managed (push-container-image + create-container-service-deployment), not Terraform/CloudFormation-first for a small service like this.
  9. Secrets live in plain env vars inside containers.json — there's no secrets-manager integration at this tier. Gitignore the real file; keep a redacted .example sibling checked in for shape.

In the Critical Viewer repo the whole sequence is scripted: python tools/deploy/lightsail/lightsail_deploy.py status | push | deploy | logs (checks the rules above, picks the highest numeric image version, polls the deployment state, prints redacted logs on failure; run deploy --dry-run first).

Full symptom → cause → fix detail (exact error text as seen) for every rule above: see REFERENCE.md.

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.