Repository navigation
feat(aws-pcs): cluster-scoped Name tag + PCS-API login lookup in docs #1183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
e9323c2
b9ee204
9ecd426
4b52e3e
43a54fc
e50b72c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -287,16 +287,20 @@ want direct SSH, set `SSHAccessCidr` to a trusted CIDR at deploy time to open SS | |
| on the login node to that CIDR. | ||
|
|
||
| **Console:** [EC2 Console](https://console.aws.amazon.com/ec2/home#Instances:) → filter | ||
| by `aws:pcs:compute-node-group-name = login` → **Connect** → **Session Manager**. | ||
| by `Name` = `<your-stack-name>-login` → **Connect** → **Session Manager**. | ||
|
|
||
| **CLI** (AWS CloudShell has the required permissions): | ||
| **CLI** (AWS CloudShell has the required permissions). Set `STACK_NAME` / | ||
| `AWS_REGION` once, then a single command resolves the login node's | ||
| instance ID — it works no matter what your CNG is named because the | ||
| lookup goes through the PCS API, not the human-facing tag: | ||
|
|
||
| ```bash | ||
| INSTANCE_ID=$(aws ec2 describe-instances \ | ||
| --filters "Name=tag:aws:pcs:compute-node-group-name,Values=login" \ | ||
| "Name=instance-state-name,Values=running" \ | ||
| --query 'Reservations[0].Instances[0].InstanceId' --output text) | ||
| aws ssm start-session --target $INSTANCE_ID | ||
| STACK_NAME=pcs-ml-cluster # your CloudFormation stack name | ||
| AWS_REGION=us-east-1 # your region | ||
|
|
||
| LOGIN_INSTANCE_ID=$(aws ec2 describe-instances --region "$AWS_REGION" --filters "Name=tag:aws:pcs:compute-node-group-id,Values=$(aws pcs list-compute-node-groups --cluster-identifier $(aws cloudformation describe-stacks --stack-name "$STACK_NAME" --region "$AWS_REGION" --query 'Stacks[0].Outputs[?OutputKey==`ClusterId`].OutputValue' --output text) --region "$AWS_REGION" --query 'computeNodeGroups[?name==`login`].id' --output text)" "Name=instance-state-name,Values=running" --query 'Reservations[0].Instances[0].InstanceId' --output text) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The nested
|
||
|
|
||
| aws ssm start-session --target "$LOGIN_INSTANCE_ID" --region "$AWS_REGION" | ||
| ``` | ||
|
|
||
| Then `sudo su - ubuntu` and use `sinfo` / `squeue` / `scontrol show nodes`. | ||
|
|
@@ -435,28 +439,38 @@ DCGM exporter image (`DcgmExporterImage`) are pinned and rarely need changing | |
| #### Accessing the Grafana dashboards | ||
|
|
||
| Log in to Grafana as **`admin`**; the password is generated per cluster and stored in | ||
| SSM Parameter Store. Retrieve it (with `CLUSTER_ID` from the stack's `ClusterId` output): | ||
| SSM Parameter Store. Retrieve it — the same `STACK_NAME` / `AWS_REGION` used in §6 | ||
| resolve the cluster's `ClusterId` from the stack Outputs: | ||
|
|
||
| ```bash | ||
| aws ssm get-parameter --name "/pcs/${CLUSTER_ID}/grafana/admin-password" \ | ||
| --with-decryption --query 'Parameter.Value' --output text | ||
| STACK_NAME=pcs-ml-cluster # your CloudFormation stack name | ||
| AWS_REGION=us-east-1 # your region | ||
|
|
||
| aws ssm get-parameter --region "$AWS_REGION" --with-decryption --query 'Parameter.Value' --output text \ | ||
| --name "/pcs/$(aws cloudformation describe-stacks --stack-name "$STACK_NAME" --region "$AWS_REGION" --query 'Stacks[0].Outputs[?OutputKey==`ClusterId`].OutputValue' --output text)/grafana/admin-password" | ||
| ``` | ||
|
|
||
| There are two ways to reach the UI. | ||
|
|
||
| ##### Option A — SSM port forwarding (default, private) | ||
|
|
||
| No public access required; works even when the login node has no inbound rules. | ||
| The monitoring stack runs on the instance tagged `monitoring-role=login`; | ||
| scope by the cluster's `aws:pcs:cluster-id` so multi-cluster VPCs don't | ||
| cross the streams. | ||
|
|
||
| ```bash | ||
| # Login node instance ID | ||
| INSTANCE_ID=$(aws ec2 describe-instances \ | ||
| --filters "Name=tag:aws:pcs:compute-node-group-name,Values=login" \ | ||
| STACK_NAME=pcs-ml-cluster # your CloudFormation stack name | ||
| AWS_REGION=us-east-1 # your region | ||
|
|
||
| LOGIN_INSTANCE_ID=$(aws ec2 describe-instances --region "$AWS_REGION" \ | ||
| --filters "Name=tag:aws:pcs:cluster-id,Values=$(aws cloudformation describe-stacks --stack-name "$STACK_NAME" --region "$AWS_REGION" --query 'Stacks[0].Outputs[?OutputKey==`ClusterId`].OutputValue' --output text)" \ | ||
| "Name=tag:monitoring-role,Values=login" \ | ||
| "Name=instance-state-name,Values=running" \ | ||
| --query 'Reservations[0].Instances[0].InstanceId' --output text) | ||
|
|
||
| # Port-forward remote 443 -> local 8443 (needs the Session Manager plugin) | ||
| aws ssm start-session --target $INSTANCE_ID \ | ||
| aws ssm start-session --target "$LOGIN_INSTANCE_ID" --region "$AWS_REGION" \ | ||
| --document-name AWS-StartPortForwardingSession \ | ||
| --parameters '{"portNumber":["443"],"localPortNumber":["8443"]}' | ||
| ``` | ||
|
|
@@ -474,11 +488,16 @@ attaches it to the login node, so you can open: | |
| https://<login-node-public-ip>/grafana/ | ||
| ``` | ||
|
|
||
| Get the login node's public IP from the EC2 console, or: | ||
| Get the login node's public IP from the EC2 console, or (again scoping by | ||
| `monitoring-role=login` + `aws:pcs:cluster-id` for the monitoring instance): | ||
|
|
||
| ```bash | ||
| aws ec2 describe-instances \ | ||
| --filters "Name=tag:aws:pcs:compute-node-group-name,Values=login" \ | ||
| STACK_NAME=pcs-ml-cluster # your CloudFormation stack name | ||
| AWS_REGION=us-east-1 # your region | ||
|
|
||
| aws ec2 describe-instances --region "$AWS_REGION" \ | ||
| --filters "Name=tag:aws:pcs:cluster-id,Values=$(aws cloudformation describe-stacks --stack-name "$STACK_NAME" --region "$AWS_REGION" --query 'Stacks[0].Outputs[?OutputKey==`ClusterId`].OutputValue' --output text)" \ | ||
| "Name=tag:monitoring-role,Values=login" \ | ||
| "Name=instance-state-name,Values=running" \ | ||
| --query 'Reservations[0].Instances[0].PublicIpAddress' --output text | ||
| ``` | ||
|
|
@@ -528,7 +547,7 @@ NCCL, FSDP), see the [Test & Validation Guide](tests/README.md). | |
|
|
||
| > **Note — node-type tagging.** The monitoring stack identifies login vs compute nodes by | ||
| > the `monitoring-role` tag (`login`/`compute`), **not** the EC2 `Name` tag — so the `Name` | ||
| > tag (default `PCS-<cngname>`) is free for you to retag without breaking dashboards. | ||
| > tag (default `<ClusterName>-<cngname>`) is free for you to retag without breaking dashboards. | ||
|
|
||
| > **Note — monitoring across login-node replacement.** Prometheus + Grafana run on the | ||
| > (single) login node. Metric collection, the Grafana password, and the built-in | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -356,15 +356,15 @@ Resources: | |||||
| Tags: | ||||||
| - Key: HPCRecipes | ||||||
| Value: "true" | ||||||
| # Name is free for arbitrary operator use. The monitoring stack | ||||||
| # identifies login vs compute nodes via the monitoring-role tag | ||||||
| # (below), not Name, so dashboards work regardless of this value. | ||||||
| # Default to PCS-<cngname> (mirrors CngName) for a recognizable | ||||||
| # console name; retag freely afterward. | ||||||
| # Name defaults to <ClusterName>-<CngName> so the EC2 console | ||||||
| # can tell instances of different clusters apart at a glance; | ||||||
| # retag freely, nothing operational reads it (monitoring keys | ||||||
| # off monitoring-role below, docs look up instances via the | ||||||
| # PCS API + aws:pcs:* tags). | ||||||
| - Key: Name | ||||||
| Value: !Sub 'PCS-${CngName}' | ||||||
| Value: !Sub '${ClusterName}-${CngName}' | ||||||
| - Key: CngName | ||||||
| Value: !Sub 'PCS-${CngName}' | ||||||
| Value: !Sub '${ClusterName}-${CngName}' | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
|
||||||
| Value: !Sub '${ClusterName}-${CngName}' | |
| Value: !Ref CngName |
(or drop the duplicate tag, since Name already carries the console-readable value). Applies to the same line in all four add-cng*.yaml.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,7 @@ Description: | | |
| - Retrieve the Grafana admin password from Parameter Store | ||
| - Terminate their own SSM sessions | ||
| They cannot create, modify, or delete cluster resources, and cannot open | ||
| shells on compute nodes (the ssm:resourceTag Name=PCS-login* scope blocks that. Note: the Name tag is operator-mutable; if you rename login nodes, update the policy accordingly). | ||
| shells on compute nodes (the ssm:resourceTag Name=*-login scope blocks that — templates default Name to <ClusterName>-<CngName>, so any login CNG matches; compute/GPU CNGs do not. Note: the Name tag is operator-mutable; if you rename login nodes, update the policy accordingly). | ||
| Metadata: | ||
| AWS::CloudFormation::Interface: | ||
| ParameterGroups: | ||
|
|
@@ -86,7 +86,7 @@ Resources: | |
| "Resource": "arn:aws:ec2:*:*:instance/*", | ||
| "Condition": { | ||
| "StringLike": { | ||
| "ssm:resourceTag/Name": "PCS-login*" | ||
| "ssm:resourceTag/Name": "*-login" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| } | ||
| } | ||
| }, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,6 +37,8 @@ BANNED=( | |
| $'DeployMonitoring=true\tMonitoringStack|internally|nested\tDeployMonitoring (bool) was replaced by MonitoringStack at the deploy-all layer' | ||
| $'S3 (public )?hosting is not allowed\tNEVERMATCH\tPostInstallScriptUrl now accepts s3:// URLs' | ||
| $'architectures/aws-pcs/iam/\tNEVERMATCH\tthe iam/ directory was removed; use docs/IAM.md + assets/cluster-*-iam.yaml' | ||
| $'aws:pcs:compute-node-group-name\tNEVERMATCH\ttag key does not exist — use `aws pcs list-compute-node-groups` + `tag:aws:pcs:compute-node-group-id`' | ||
| $'Name=tag:Name,Values=PCS-\tNEVERMATCH\tthe Name tag is <ClusterName>-<CngName>; resolve the login node via the PCS API instead' | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The new lint gives a false all-clear — two Jupyter docs still carry the patterns it's meant to eradicateThis PR replaces the mutable-
I checked live that these two new patterns ( |
||
| ) | ||
| for entry in "${BANNED[@]}"; do | ||
| IFS=$'\t' read -r pat allow msg <<<"$entry" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
§6 rationale is slightly self-contradictory — the resilience is against the
Nametag, not the CNG nameSmall wording thing: the §6 intro says the lookup "works no matter what your CNG is named because the lookup goes through the PCS API." But the lookup hardcodes
computeNodeGroups[?name==\login`], so it *does* depend on the login CNG being namedlogin(which deploy-all guarantees). What the PCS-API path actually buys you is independence from the mutable EC2Name` tag — that's the real win worth stating.