Scaffold a new AWS IaC project.
Framework: $ARGUMENTS[0] (cdk, terraform, sam, or cfn) Description: $ARGUMENTS[1]
Process
- Ask clarifying questions if the framework or description is unclear
- Use the
aws-iacMCP tools to validate resource configurations and check for security issues - Use the
awsknowledgeMCP tools (mcp__plugin_aws-dev-toolkit_awsknowledge__aws___search_documentation,mcp__plugin_aws-dev-toolkit_awsknowledge__aws___read_documentation,mcp__plugin_aws-dev-toolkit_awsknowledge__aws___recommend) to look up current best practices for the chosen framework - Generate the project structure following the patterns in templates/
Framework-Specific Guidance
CDK (TypeScript default)
- Use
cdk init app --language typescriptpatterns - Separate stacks by lifecycle (networking, data, compute)
- Use
cdk-nagfor compliance checks - Outputs for cross-stack references
Terraform
- Module-per-service structure
- Remote state in S3 + DynamoDB locking
- Use
terraform-aws-moduleswhere they exist - Separate tfvars per environment
SAM
- template.yaml at root
- Globals section for shared Lambda config
- Use SAM Accelerate for fast iteration
CloudFormation
- Nested stacks for reuse
- Parameters with AllowedValues for guardrails
- Conditions for multi-environment templates
Gotchas
- Always include a
.gitignoreappropriate for the framework - CDK: don't put secrets in context — use SSM Parameter Store or Secrets Manager
- Terraform: never commit
.tfstate— configure remote backend first - SAM:
sam localneeds Docker — mention this in the README - All frameworks: tag everything with at minimum
Environment,Project,Owner - Include a Makefile or justfile with common commands (deploy, destroy, diff, synth)
Output
Generate the complete project structure with:
- Entry point / main config file
- At least one example resource
- Environment-specific configuration
- README with setup instructions
- CI/CD pipeline config (GitHub Actions default, ask if different)