Skip to main content

Claude/ChatGPT Prompt to Design an ECS Fargate Deployment

Design an AWS ECS Fargate deployment - task definitions, service config, load balancing, auto-scaling, and CI/CD integration.

Fill in the placeholders

Edit the values, then copy your finished prompt.

Your Prompt
prompt.txt
Design an ECS Fargate deployment for my Node.js API with background worker application running 2 (API server + Celery worker) containers. 1) Task Definition: configure 512 (0.5 vCPU) CPU and 1024 MB memory, define container definitions with log configuration using awslogs to CloudWatch Logs, environment variables from SSM Parameter Store and Secrets Manager, and health check. 2) Service: create an ECS Service with 3 desired tasks, deployment configuration (minimumHealthyPercent: 100, maximumPercent: 200) for zero-downtime deployments. 3) Load Balancer: configure ALB with target group, health check path /api/health, and deregistration delay. 4) Networking: set up VPC with tasks in private subnets, ALB in public subnets subnets, security groups allowing only ALB-to-task traffic, and NAT Gateway for outbound. 5) Auto-scaling: configure Application Auto Scaling with target tracking on CPU utilization at 70% between 2-10 tasks. 6) Service Discovery: set up Cloud Map for service-to-service communication with AWS Cloud Map (no App Mesh). 7) CI/CD: create a GitHub Actions or CodePipeline workflow that builds, pushes to ECR, and triggers ECS rolling deployment. 8) Cost optimization: compare Fargate vs Fargate Spot for the background worker tasks workloads.

What this prompt does

This prompt drives the AI to design an ECS Fargate deployment for [application_type] running [container_count] containers. It builds a task definition with [task_cpu] CPU, [task_memory] memory, [log_driver] logging, secrets from [secrets_source], and health checks; an ECS Service with [desired_count] tasks and zero-downtime deployment percentages; an ALB with health-check path [health_path]; VPC networking using [subnet_strategy]; auto-scaling on [scaling_metric] between [min_tasks] and [max_tasks]; service discovery via [service_mesh]; a CI/CD workflow to ECR and ECS; and a Fargate-versus-Spot comparison for [spot_eligible] workloads.

The structure works because it pins the details that make container deploys predictable — deployment percentages (minimumHealthyPercent 100, maximumPercent 200), health checks, and a Spot split — early. Putting tasks in private subnets behind an ALB and restricting traffic to ALB-to-task keeps the network surface tight. The Spot split lets cost-tolerant workloads run cheaper without risking the latency-sensitive ones. Sizing [task_cpu] and [task_memory] together up front matters because Fargate only accepts specific CPU/memory pairings, and getting the combination wrong is the kind of error that surfaces only at deploy time.

When to use it

  • You want zero-downtime container deploys without managing the underlying nodes.
  • You need a task definition with the right [task_cpu]/[task_memory] split and proper health checks.
  • You want auto-scaling on [scaling_metric] between [min_tasks] and [max_tasks] configured correctly.
  • You need ALB load balancing with a sensible [health_path] and deregistration delay.
  • You want a CI/CD workflow that builds, pushes to ECR, and triggers a rolling ECS deployment.
  • You want to run [spot_eligible] workloads on Fargate Spot to cut cost without risking critical tasks.

Example output

Expect a deployment spec: a task definition with container definitions, [log_driver] logging, secrets from [secrets_source], and health checks; an ECS Service config with deployment percentages for zero downtime; an ALB and target-group setup with [health_path]; a VPC layout following [subnet_strategy] with tight security groups; an Application Auto Scaling policy on [scaling_metric]; a Cloud Map service-discovery config; a CI/CD workflow; and a Fargate-vs-Spot cost comparison for [spot_eligible].

Pro tips

  • Pin deployment percentages to minimumHealthyPercent 100 and maximumPercent 200 for true zero-downtime rolling deploys; lower minimums risk a brief capacity dip.
  • Set [health_path] to a real readiness endpoint and tune the deregistration delay so in-flight requests drain before a task is killed.
  • Put tasks in private subnets per [subnet_strategy] and allow only ALB-to-task traffic in the security group; do not expose tasks directly.
  • Right-size [task_cpu] and [task_memory] together — Fargate only allows valid CPU/memory combinations, so an arbitrary pair will be rejected.
  • Run [spot_eligible] background workers on Fargate Spot but keep latency-sensitive tasks on regular Fargate, since Spot capacity can be reclaimed.
  • Pull secrets from [secrets_source] rather than baking them into the task definition environment, which keeps them out of plaintext task config.
  • Wire the CI/CD workflow to build, push to ECR, and trigger the rolling deployment in one pipeline so a deploy is a single tracked action rather than a manual sequence of steps.

Frequently Asked Questions

Does this give me zero-downtime deployments?
Yes — it sets deployment configuration to minimumHealthyPercent 100 and maximumPercent 200, so new tasks come up healthy before old ones drain. Pairing that with a real `[health_path]` and deregistration delay is what makes rolling deploys genuinely seamless.
Can I run some tasks on Fargate Spot to save money?
It compares Fargate versus Fargate Spot for `[spot_eligible]` workloads like background workers. Keep latency-sensitive tasks on regular Fargate, since Spot capacity can be reclaimed with little notice and interrupt those workloads.
How does auto-scaling work here?
It configures Application Auto Scaling with target tracking on `[scaling_metric]`, scaling between `[min_tasks]` and `[max_tasks]`. Target tracking adjusts task count to hold the metric near its target, which is simpler to reason about than step scaling for most services.
Where do secrets and environment variables come from?
Secrets are pulled from `[secrets_source]` such as SSM Parameter Store and Secrets Manager rather than hardcoded in the task definition. That keeps credentials out of plaintext task config, which is both safer and easier to rotate.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

More in AWS & Cloud Architecture Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

AI assistant · trained on my work

👋

Hey there!

Quick Actions

WhatsApp Direct line to me

Chat on WhatsApp

+880 1723 741224 · Replies within the hour on working days

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

mejba.13@gmail.com

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support