@aws/ml-container-creator 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/bin/cli.js +5 -2
  2. package/config/bootstrap-stack.json +86 -7
  3. package/config/defaults.json +1 -1
  4. package/infra/ci-harness/buildspec.yml +60 -0
  5. package/package.json +3 -1
  6. package/servers/README.md +41 -1
  7. package/servers/instance-sizer/index.js +42 -2
  8. package/servers/instance-sizer/lib/instance-ranker.js +114 -10
  9. package/servers/instance-sizer/lib/quota-resolver.js +368 -0
  10. package/servers/instance-sizer/package.json +2 -0
  11. package/servers/lib/catalogs/instances.json +527 -12
  12. package/servers/lib/catalogs/model-servers.json +15 -15
  13. package/servers/lib/catalogs/model-sizes.json +27 -0
  14. package/servers/lib/catalogs/models.json +71 -0
  15. package/servers/lib/schemas/image-catalog.schema.json +9 -1
  16. package/src/app.js +109 -3
  17. package/src/lib/bootstrap-command-handler.js +96 -3
  18. package/src/lib/cli-handler.js +2 -2
  19. package/src/lib/config-manager.js +117 -1
  20. package/src/lib/deployment-entry-schema.js +16 -0
  21. package/src/lib/prompt-runner.js +270 -12
  22. package/src/lib/prompts.js +288 -6
  23. package/src/lib/registry-command-handler.js +12 -0
  24. package/src/lib/schema-sync.js +31 -0
  25. package/src/lib/template-manager.js +49 -1
  26. package/src/lib/validate-runner.js +125 -2
  27. package/templates/Dockerfile +22 -2
  28. package/templates/code/cuda_compat.sh +22 -0
  29. package/templates/code/serve +3 -0
  30. package/templates/code/serving.properties +14 -0
  31. package/templates/code/start_server.sh +3 -0
  32. package/templates/diffusors/Dockerfile +2 -1
  33. package/templates/diffusors/serve +3 -0
  34. package/templates/do/README.md +33 -0
  35. package/templates/do/adapter +1214 -0
  36. package/templates/do/adapters/.gitkeep +2 -0
  37. package/templates/do/add-ic +130 -0
  38. package/templates/do/benchmark +718 -0
  39. package/templates/do/clean +593 -17
  40. package/templates/do/config +49 -4
  41. package/templates/do/deploy +513 -362
  42. package/templates/do/ic/default.conf +32 -0
  43. package/templates/do/lib/endpoint-config.sh +216 -0
  44. package/templates/do/lib/inference-component.sh +167 -0
  45. package/templates/do/lib/secrets.sh +44 -0
  46. package/templates/do/lib/wait.sh +131 -0
  47. package/templates/do/logs +107 -27
  48. package/templates/do/optimize +528 -0
  49. package/templates/do/register +119 -2
  50. package/templates/do/status +337 -0
  51. package/templates/do/test +80 -28
  52. package/templates/triton/Dockerfile +5 -0
@@ -0,0 +1,2 @@
1
+ # This file ensures the do/adapters/ directory is tracked by git
2
+ # Adapter metadata files (*.conf) are stored here after do/adapter add
@@ -0,0 +1,130 @@
1
+ #!/bin/bash
2
+ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ # SPDX-License-Identifier: Apache-2.0
4
+ #
5
+ # Add a new inference component to this project.
6
+ # Creates a new IC config file in do/ic/ and deploys it immediately.
7
+
8
+ set -e
9
+ set -u
10
+ set -o pipefail
11
+
12
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
13
+ source "${SCRIPT_DIR}/config"
14
+
15
+ echo "➕ Add New Inference Component"
16
+ echo " Project: ${PROJECT_NAME}"
17
+ echo ""
18
+
19
+ # ============================================================
20
+ # Prompt for IC name
21
+ # ============================================================
22
+ while true; do
23
+ read -p "IC name (lowercase alphanumeric + hyphens): " IC_NAME
24
+
25
+ # Validate: non-empty
26
+ if [ -z "${IC_NAME}" ]; then
27
+ echo " ❌ IC name cannot be empty."
28
+ continue
29
+ fi
30
+
31
+ # Validate: lowercase alphanumeric + hyphens only
32
+ if ! echo "${IC_NAME}" | grep -qE '^[a-z0-9]([a-z0-9-]*[a-z0-9])?$'; then
33
+ echo " ❌ IC name must be lowercase alphanumeric with hyphens (e.g., 'llama-70b')."
34
+ echo " Must start and end with a letter or number."
35
+ continue
36
+ fi
37
+
38
+ # Validate: no collision with existing config
39
+ if [ -f "${SCRIPT_DIR}/ic/${IC_NAME}.conf" ]; then
40
+ echo " ❌ IC config already exists: do/ic/${IC_NAME}.conf"
41
+ echo " Choose a different name or edit the existing config."
42
+ continue
43
+ fi
44
+
45
+ break
46
+ done
47
+
48
+ # ============================================================
49
+ # Prompt for image tag
50
+ # ============================================================
51
+ DEFAULT_IMAGE_TAG="${PROJECT_NAME}-latest"
52
+ read -p "Image tag [${DEFAULT_IMAGE_TAG}]: " IC_IMAGE_TAG
53
+ IC_IMAGE_TAG="${IC_IMAGE_TAG:-${DEFAULT_IMAGE_TAG}}"
54
+
55
+ # ============================================================
56
+ # Prompt for GPU count
57
+ # ============================================================
58
+ read -p "GPU count [1]: " IC_GPU_COUNT
59
+ IC_GPU_COUNT="${IC_GPU_COUNT:-1}"
60
+
61
+ # Validate numeric
62
+ if ! echo "${IC_GPU_COUNT}" | grep -qE '^[0-9]+$'; then
63
+ echo " ❌ GPU count must be a positive integer."
64
+ exit 1
65
+ fi
66
+
67
+ # ============================================================
68
+ # Prompt for copy count
69
+ # ============================================================
70
+ read -p "Copy count [1]: " IC_COPY_COUNT
71
+ IC_COPY_COUNT="${IC_COPY_COUNT:-1}"
72
+
73
+ # Validate numeric
74
+ if ! echo "${IC_COPY_COUNT}" | grep -qE '^[0-9]+$'; then
75
+ echo " ❌ Copy count must be a positive integer."
76
+ exit 1
77
+ fi
78
+
79
+ # ============================================================
80
+ # Prompt for memory MB
81
+ # ============================================================
82
+ read -p "Min memory MB [1024]: " IC_MIN_MEMORY_MB
83
+ IC_MIN_MEMORY_MB="${IC_MIN_MEMORY_MB:-1024}"
84
+
85
+ # Validate numeric
86
+ if ! echo "${IC_MIN_MEMORY_MB}" | grep -qE '^[0-9]+$'; then
87
+ echo " ❌ Memory MB must be a positive integer."
88
+ exit 1
89
+ fi
90
+
91
+ # ============================================================
92
+ # Create IC config file
93
+ # ============================================================
94
+ IC_CONF_PATH="${SCRIPT_DIR}/ic/${IC_NAME}.conf"
95
+ mkdir -p "${SCRIPT_DIR}/ic"
96
+
97
+ cat > "${IC_CONF_PATH}" <<EOF
98
+ # Per-IC configuration: ${IC_NAME}
99
+ # Created by do/add-ic on $(date -u +"%Y-%m-%dT%H:%M:%SZ")
100
+ #
101
+ # This file is sourced by do/lib/inference-component.sh during deployment.
102
+ # After deployment, IC_DEPLOYED_NAME and IC_DEPLOYED_AT will be appended
103
+ # by the deploy script to track the active inference component.
104
+
105
+ export IC_IMAGE_TAG="${IC_IMAGE_TAG}"
106
+ export IC_GPU_COUNT=${IC_GPU_COUNT}
107
+ export IC_COPY_COUNT=${IC_COPY_COUNT}
108
+ export IC_MIN_MEMORY_MB=${IC_MIN_MEMORY_MB}
109
+ export IC_STARTUP_TIMEOUT=900
110
+
111
+ # Optional overrides:
112
+ # export IC_MODEL_NAME="my-model-v2"
113
+ # export IC_CONTAINER_ENV_EXTRA='"KEY":"value"'
114
+
115
+ EOF
116
+
117
+ echo ""
118
+ echo "✅ Created IC config: do/ic/${IC_NAME}.conf"
119
+ echo " Image tag: ${IC_IMAGE_TAG}"
120
+ echo " GPU count: ${IC_GPU_COUNT}"
121
+ echo " Copy count: ${IC_COPY_COUNT}"
122
+ echo " Memory MB: ${IC_MIN_MEMORY_MB}"
123
+ echo ""
124
+
125
+ # ============================================================
126
+ # Deploy the new IC immediately
127
+ # ============================================================
128
+ echo "🚀 Deploying IC '${IC_NAME}'..."
129
+ echo ""
130
+ exec "${SCRIPT_DIR}/deploy" --ic "${IC_NAME}"