AWS CDK Infrastructure Rules

AWS CDK Infrastructure Rules

Lays down a platform engineer's rules for AWS CDK in TypeScript: small stacks, retained stateful resources, CI-only deploys, diffs in pull requests and cdk-nag.

AWS CDK Infrastructure taste of a platform engineer who wants boring, reviewable cloud changes

  • Write CDK apps in TypeScript so constructs, props and IDE hints are fully typed. Confidence: 0.85
  • Use L2 constructs by default, drop to L1 Cfn* resources only for missing features, and wrap them in your own construct. Confidence: 0.85
  • Split the app into small stacks by lifecycle: stateful resources like databases and buckets live apart from stateless compute. Confidence: 0.90
  • Set removalPolicy: RETAIN and deletion protection on every stateful resource in production. Confidence: 0.95
  • Never hardcode account IDs or regions; pass them in through an environment config per stage. Confidence: 0.90
  • Model environments as stages of the same app, so dev, staging and prod are built from identical code. Confidence: 0.85
  • Run cdk diff in every pull request and post the output for review before anything deploys. Confidence: 0.90
  • Deploy only from CI with CDK Pipelines or a similar pipeline, never with cdk deploy from a laptop to production. Confidence: 0.90
  • Grant permissions with construct methods like bucket.grantRead(fn) instead of writing IAM policy JSON by hand. Confidence: 0.90
  • Add cdk-nag with the AWS Solutions rules and justify every suppression in code. Confidence: 0.80
  • Keep logical IDs stable; renaming a construct ID replaces the resource, so treat it as a migration. Confidence: 0.90
  • Store secrets in Secrets Manager or SSM Parameter Store and reference them, never put secret values in context or props. Confidence: 0.95
  • Tag every resource with owner, service and cost center through Tags.of(app). Confidence: 0.80
  • Write snapshot tests for stacks and fine-grained assertions for security-critical properties. Confidence: 0.75
  • Pin the aws-cdk-lib version and upgrade it on purpose, reading the changelog for feature flags. Confidence: 0.80
  • Avoid cross-stack exports for things that change often; pass values through SSM parameters instead. Confidence: 0.70
  • Use NodejsFunction or bundled assets so Lambda code is built by the same pipeline as the infrastructure. Confidence: 0.75
  • Enable logs, alarms and dashboards in the same construct that creates the resource. Confidence: 0.80
  • Keep cdk.context.json committed so lookups are deterministic across machines. Confidence: 0.85

Public domain (CC0 1.0) · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 13,342 prompts

More by @OpenSourceBuffGuy

See all
POV blue pencil turns city into sketches prompt image

POV blue pencil turns city into sketches

Generates a first-person video where a blue pencil traces a train, cat, bus and woman, turning each from live action into a different hand-drawn style.

video-prompt, pov, transformation, visual-effects, line-art, animation, scene-transitions, multi-shot, camera-movement, cityscape, animals, cartoon, pastel, sketch, natural-light, cinematic, seedance, for-filmmakers, for-content-creators, for-artists, whimsical, humorous, long-form, text-to-video

Walking POV down station steps onto a seaside train prompt image

Walking POV down station steps onto a seaside train

Generates a one-take first-person POV video of a morning commute in coastal Japan: station stairs, a stroked orange cat, a window seat and rails running beside the sea.

video-prompt, pov, single-take, vlog, timed-beats, handheld, japan, photorealistic, natural-light, ocean, animals, seedance, sound-effects, travel, cityscape, widescreen, camera-movement, long-form, negative-prompt

Kitten knight shields dragon egg in snowstorm prompt image

Kitten knight shields dragon egg in snowstorm

Directs a 24-second live-action fantasy short in which an armoured kitten shields a dragon egg in a snowstorm, with five timed scenes and a consistency block.

video-prompt, timed-beats, multi-shot, fantasy-world, creatures, animals, winter, character-consistency, cinematic, photorealistic, negative-prompt, guardrails, camera-movement, golden-hour, seedance, short-film, warriors, dramatic-lighting, long-form, shallow-depth-of-field

Reviews

Loading reviews…

Discussion

Loading comments…