Skip to main content

Claude/ChatGPT Prompt to Generate CloudFormation / CDK IaC Templates

Generate AWS CloudFormation or CDK infrastructure-as-code for common architectures with best practices and parameterization.

Füllen Sie die Platzhalter aus

Edit the values, then copy your finished prompt.

Ihr Prompt
prompt.txt

                                

What this prompt does

This prompt asks the AI to generate deployable infrastructure-as-code for a complete AWS architecture in one pass. You choose your [iac_tool] — CDK in TypeScript, CloudFormation, or another flavor — and an [architecture_type] like a three-tier web app, and the model produces networking, compute, database, caching, load balancing, security, and monitoring as code. The eight numbered steps cover a VPC with [vpc_cidr] across [az_count] availability zones, a [compute_resource], a [database_service] with Multi-AZ and encryption, and an ALB terminating HTTPS for [domain].

The structure works because it front-loads the decisions that are painful to retrofit. By specifying least-privilege IAM for [iam_roles], Multi-AZ databases tuned for [db_workload], and a [stack_structure] split with cross-stack references up front, the generated code lands close to deployable rather than as a toy snippet. I treat the output as a strong first draft — review and harden it — instead of writing infrastructure from a blank file.

When to use it

  • You are bootstrapping a new environment and want repeatable IaC instead of clicking through the console
  • You need a sensible starting point for a [architecture_type] with networking, compute, and database wired together
  • You want least-privilege IAM roles scaffolded for [iam_roles] rather than over-permissioned defaults
  • You are standardizing on [iac_tool] and need a reference template that follows current best practices
  • You want the stack split into [stack_structure] for maintainability and cross-stack references
  • You need CloudWatch alarms and a tagging strategy included from the start

Example output

Expect generated IaC files organized into the stacks you requested — for example network, database, compute, and monitoring — each defining its resources with security groups, IAM roles, parameter groups for [db_workload], an ALB with an ACM certificate, and CloudWatch alarms for CPU, memory, and database connections. The code is parameterized and annotated, designed to deploy with minimal modification after your review.

Pro tips

  • Match [iac_tool] to your team's real workflow; CDK in TypeScript gives you loops and abstractions, while raw CloudFormation is more portable but more verbose
  • Keep [vpc_cidr] and [az_count] consistent with your other environments so peering and expansion stay clean
  • Specify [db_workload] precisely — "read-heavy OLTP with periodic reporting" drives different parameter-group and read-replica choices than a write-heavy workload
  • Always review the generated IAM for [iam_roles]; the model aims for least privilege but you should confirm no action is broader than needed before deploying
  • Treat the output as a draft, not production-ready code — run it through your linter, security scanner, and a plan/diff before applying
  • Iterate stack by stack rather than deploying all of [stack_structure] at once, so failures are easy to isolate
  • Pin versions for the [database_service] and [compute_resource] explicitly so a regenerated template doesn't silently bump an engine version on you
  • Confirm the ALB's ACM certificate for [domain] is validated in the right region before deploy, since a missing certificate blocks the HTTPS listener

Frequently Asked Questions

Is the generated CDK or CloudFormation ready to deploy as-is?
Treat it as a strong first draft, not finished code. The prompt is designed to produce output that deploys with minimal modification, but you should review IAM scopes, run a plan or diff, and pass it through your security tooling before applying it to any real account.
Can I use this for CloudFormation instead of CDK?
Yes. Set `[iac_tool]` to CloudFormation, the AWS SDK, Terraform, or whichever tool your team uses, and the prompt adapts the output accordingly. CDK in TypeScript gives you programmatic constructs and loops, while CloudFormation YAML is more portable but more verbose to maintain.
How does it decide database settings like Multi-AZ and parameter groups?
It uses the `[database_service]` and `[db_workload]` variables to shape those choices. Describing your workload accurately — for example read-heavy OLTP with periodic reporting — leads to more appropriate parameter groups and replica suggestions than a generic default, so be specific here.
Will it follow least-privilege for the IAM roles?
It aims to, generating scoped roles for the `[iam_roles]` you list rather than blanket admin policies. Because the model cannot see your runtime access patterns, you must still review each policy and tighten any action that is broader than the role actually needs before deploying.
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.

Mehr in AWS & Cloud Architecture Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

Claude Code Expert · Online

👋

Hey there!

Quick Actions

WhatsApp Instant reply

Chat on WhatsApp

+880 1723 741224 · Instant reply

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

[email protected]

✓ 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