agentleFS
ai-enhanced-engineerai-enhanced-engineer/aiee-skills/skills/aws-app-runner/SKILL.md

aws-app-runner

Skill4 starsChanged 5 months agoMITView on GitHub

AWS App Runner and ECS Express Mode deployment patterns for stateless Python services. Use when deploying containerized APIs, configuring health checks, managing auto-scaling, or migrating from App Runner to ECS Express Mode.

The file

Files
SKILL.md

AWS Container Deployment Patterns

ECS Express Mode is the recommended path for new deployments (late 2025+). App Runner enters maintenance mode April 30, 2026 — no new customers, no new features. ECS Express Mode provides the same simplicity (single API call) with full ECS/Fargate feature set. ALB adds ~$16-25/month fixed cost. Existing App Runner services continue working indefinitely.

Service Selection

CriterionApp RunnerECS Express ModeECS FargateLambda
ComplexityLowLowHighLow
Scale-to-zeroNo (min=1)YesYesYes
Request timeout120sUnlimitedUnlimited15min
VPC integrationVia connectorNativeNativeVia config
StatusMaintenance modeRecommendedMatureMature
Best forExisting servicesNew simple APIsComplex microservicesEvent-driven

Core Constraints (App Runner)

ConstraintValueImplication
Port8080 (configurable)Set via Port in service config
StatelessNo local file persistenceUse S3/ElastiCache for state
Min instances1 (no scale-to-zero)~$2.55/month min (idle memory-only billing)
Max concurrency1-200 per instancePython sync: 10-50, async: 50-150

Quick Reference

Port Binding

import os
import uvicorn

port = int(os.environ.get("PORT", 8080))
uvicorn.run(app, host="0.0.0.0", port=port)

Health Checks

@app.get("/health")
async def health():
    return {"status": "healthy"}

HTTP health checks preferred over TCP for production. Config: 10s interval, 5s timeout, 1 healthy / 5 unhealthy threshold.

Cold Start Optimization

TechniqueImpact
Multi-stage Docker buildsSmaller image → faster pull
Min instances = 1+Eliminates cold starts (costs more)
Preload models at startupAmortize once per instance
python:3.12-slim base150MB vs 1GB+ full image

IAM Roles (Two-Role Pattern)

App Runner requires two separate IAM roles with different trust principals:

RoleTrust PrincipalPurposeAttached Policy
ECR Access Rolebuild.apprunner.amazonaws.comPull private ECR imagesAWSAppRunnerServicePolicyForECRAccess (managed)
Task Roletasks.apprunner.amazonaws.comContainer calls AWS APIs (e.g., Secrets Manager)Custom policy scoped to needed services
  • ECR access role is passed as access_role_arn in authentication_configuration
  • Task role is passed as instance_role_arn in instance_configuration
  • Using the wrong principal silently breaks image pulls (ECR) or container API calls (task)
  • apprunner.amazonaws.com (without prefix) is not valid for either role

Anti-Patterns

Anti-PatternPattern
Setting min_size=0 expecting scale-to-zeroApp Runner min is 1 — use Lambda or ECS Express for scale-to-zero
Hardcoded port in DockerfileUse PORT env var: os.environ.get("PORT", 8080)
Storing files locally between requestsUse S3 for persistence — instances are ephemeral
Skipping VPC connector for DB accessPrivate RDS requires VPC connector — public endpoints are a security risk
Using latest tag with auto-deployUse SHA-based tags for reproducible deployments
Choosing App Runner for new projects (2026+)Use ECS Express Mode — same simplicity, no maintenance-mode risk
Using apprunner.amazonaws.com as task role principalTask role must use tasks.apprunner.amazonaws.com; wrong principal silently prevents container from assuming the role
Confusing ECR access role with task roleECR access role (build.apprunner.amazonaws.com) pulls images; task role (tasks.apprunner.amazonaws.com) grants container AWS API access — they are distinct resources

Cost Patterns

ScenarioEstimated Monthly Cost
Idle (1 instance, 0.25 vCPU, 0.5 GB, no traffic)~$2.55 (memory only)
Low traffic (1-2 instances, 1 vCPU, 2 GB)~$25-50
Medium traffic (2-5 instances, 1 vCPU, 2 GB)~$50-125

Idle instances bill memory only ($0.007/GB-hr), not vCPU. Active instances bill both.

See reference.md for VPC connector patterns, Secrets Manager integration, and service configuration details. See examples.md for Terraform HCL blocks and auto-scaling configuration.

Related

  • aws-security-hardening — IAM trust policies, OIDC, task-role separation patterns this skill consumes
  • aws-cicd-patterns — the CI pipeline that builds and pushes images into the App Runner deploy target
  • caddy-tls-proxy — alternate deployment shape (single-EC2 + Caddy) for cases where App Runner cold-start or VPC connector cost rules it out

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.