awsome-distributed-ai / terraform-modules
AGENTS.md501 starsChanged 3 months agoMIT-0View on GitHub
Multi-architecture reference repo for distributed ML training on AWS (SageMaker HyperPod, ParallelCluster, Batch, EKS). Each subdirectory under architectures/ is largely self-contained. Path: architectures/sagemaker-hyperpod-eks/terraform-modules/hyperpod-eks-tf/ This Terraform stack deploys a SageMaker HyperPod cluster on EKS. The EKS control plane is a prerequisite for HyperPod — it is NOT an independent EKS deployment. All features must be compatible with HyperPod's SageMaker-managed instances. HyperPod instances are SageMaker-managed and have these implications: Path: modules/cilium/ Modes: overlay (VXLAN tunnel), chaining (VPC CNI + Cilium policy), custom…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 35,337 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository12 other files it gives its agents.
- AGENTS.mdAGENTS.md
- architectures/sagemaker-hyperpod-eks/slinky-slurm/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- bash-testingSkill
- build-slurm-imageSkill
- deploy-infrastructureSkill
- deployment-preflightSkill
- deploy-slurm-clusterSkill
- validate-deploymentSkill
- hyperpod-devops-agent-solutionSkill
- hyperpod-incident-rcaSkill
- hyperpod-incident-triageSkill
The file
We split this AGENTS.md into the rules it gives an agent
4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 17
Every module has: main.tf, variables.tf, outputs.tf (minimum)
- Very specific: line 21
All variables require description and type.
- Very specific: line 62
No Terraform tests exist (no terratest, no terraform test) — validate manually
- Distinctive: line 101
No Terraform-specific CI validation currently
≈ “Common” is an estimate: at least 1 in 5 of the 45,344 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md
Repository Overview
Multi-architecture reference repo for distributed ML training on AWS (SageMaker HyperPod, ParallelCluster, Batch, EKS). Each subdirectory under architectures/ is largely self-contained.
Active Work Area: Terraform Modules
Path: architectures/sagemaker-hyperpod-eks/terraform-modules/hyperpod-eks-tf/
This Terraform stack deploys a SageMaker HyperPod cluster on EKS. The EKS control plane is a prerequisite for HyperPod — it is NOT an independent EKS deployment. All features must be compatible with HyperPod's SageMaker-managed instances.
Terraform Conventions
- Terraform >= 1.14.0 required (see
versions.tffor full provider constraints) - Module naming:
snake_casedirectories undermodules/ - Every module has:
main.tf,variables.tf,outputs.tf(minimum) - Split additional resource types into named files (e.g.,
iam_roles.tf,vpc_endpoints.tf) - Conditional creation at root level:
count = var.create_<module>_module ? 1 : 0 - Resource naming:
"${var.resource_name_prefix}-SMHP-<ResourceType>" - All variables require
descriptionandtype; complex types useobject()withoptional() - Feature flags:
create_<module>_module(bool) — infrastructure defaultstrue, addons defaultfalse - Existing resource inputs:
existing_<resource>_id/existing_<resource>_name - Input validation via
validation { condition = ..., error_message = ... }blocks - Uses both
awsandawsccproviders (awscc for SageMaker cluster resources) - Helm chart revisions pinned to git commit SHAs, not tags
Commands
# From hyperpod-eks-tf/ directory:
terraform init
terraform plan -var-file="custom.tfvars"
terraform apply -var-file="custom.tfvars"
# Format check (not automated in CI but expected):
terraform fmt -recursive
# Validate:
terraform validateKey Files
variables.tf— all input variables (~900 lines), the source of truth for configuration surfacemain.tf— orchestration with explicitdepends_onbetween modulesproviders.tf— aws, awscc, helm, kubernetes, grafana provider configscustom.tfvars/closed-network.tfvars/rig_custom.tfvars— environment-specific var files (gitignored patterns).gitignore— ignores.terraform/,*.tfstate*,.terraform.lock.hcl,env_vars.sh,terraform_outputs.json,docs/
Module Dependency Order
vpc → private_subnet → security_group → eks_cluster → cilium → helm_chart → hyperpod_cluster → fsx_lustreGotchas
.terraform.lock.hclis gitignored — provider locks are not committedlocal.rig_modeauto-disables incompatible features when RIG (restricted instance groups) are configured- Some operations use
null_resource+local-execas workarounds for missing provider support - No Terraform tests exist (no terratest, no
terraform test) — validate manually fsx_lustreunconditionally referencesmodule.hyperpod_cluster[0].primary_subnet_id— must passcreate_fsx_module=falseif you disable HyperPod (create_hyperpod_module=false)helm_chartmodule requires/tmp/helm-repoto contain a clone ofhttps://github.com/aws/sagemaker-hyperpod-cli.githelm_release.ciliumuseswait = falsebecause Cilium DaemonSet can't schedule until HyperPod nodes join (chicken-and-egg)
HyperPod Platform Constraints
HyperPod instances are SageMaker-managed and have these implications:
- Not visible in EC2 API —
ec2:DescribeInstancescannot find them. Any feature requiring EC2 instance discovery will fail. - Cilium ENI mode incompatible — removed from this stack. Only
overlay,chaining, andcustommodes are supported. - Node identity — nodes register as
hyperpod-i-<instance-id>but the instance ID is internal to SageMaker.
Cilium CNI Module
Path: modules/cilium/
Modes: overlay (VXLAN tunnel), chaining (VPC CNI + Cilium policy), custom (user provides all values)
Key design decisions:
skip_vpc_cnilocal in rootmain.tfconditionally removes the VPC CNI EKS addon when mode != "chaining"enable_vxlan_rulein security_group module adds UDP 8472 rules only for overlay mode- Helm chart from
https://helm.cilium.io/, version pinned viacilium_versionvariable (default1.19.4)
Repo-Wide Conventions
- External dependencies must pin versions (commit SHA or tag, never
latest) - Scripts numbered sequentially starting at 0:
0.preprocessing.sh,1.processing.sh, ... - Each asset self-contained with its own README, prerequisites, and copy-pasteable commands
- Infrastructure as Code: CloudFormation, CDK, or Terraform only
- Git LFS required for
.gif,.zip,.tar.bz2,.tar.gzfiles - EditorConfig: LF endings, UTF-8, trim trailing whitespace, indent 2 for YAML/JSON
- Markdown lint: line length 100 (code blocks exempt), inline HTML allowed, no first-line heading rule
CI / PR Process
- PRs target
mainbranch;contentbranch is AWS-internal blog content (auto-closes external PRs) - Static analysis on PRs: pylint, flake8, bandit, semgrep (Python code only)
- No Terraform-specific CI validation currently
Commit Style
Mixed but trending conventional: type(scope): description (#PR) — e.g., fix(healthcheck): ..., chore: ..., docs: ...
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
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.

