ssh Block in eksctl Node Groups
ssh Block in eksctl Node Groups
The ssh section is used to configure SSH or SSM access to the EC2 instances in your managed or self-
managed node groups.
nodeGroups:
- name: example-ng
instanceType: t3.medium
ssh:
allow: true
publicKeyPath: ~/.ssh/id_rsa.pub
sourceSecurityGroupIds:
- sg-0123456789abcdef0
enableSsm: true
🧾 Field-by-Field Breakdown
Field Description
allow
Enables or disables SSH access for this node group. Must be true to allow any
SSH config to take effect.
publicKeyPath
Path to your local public SSH key file (default: ~/.ssh/id_rsa.pub). This key is
injected into the instance for SSH access.
publicKey
You can provide the actual public key string directly here (instead of using a
path).
publicKeyName
Name of an existing EC2 key pair in AWS to associate with the instance. Use this
instead of publicKeyPath or publicKey.
sourceSecurityGroupIds
List of security group IDs that are allowed to access the nodes via SSH (port 22).
Required if your nodes are in a private subnet.
enableSsm
Enables access to EC2 instances via AWS Systems Manager Session Manager
(SSM) — no need to use SSH/port 22.
✅ Example Scenarios
📌 1. Basic SSH with default key
ssh:
allow: true
publicKeyPath: ~/.ssh/id_rsa.pub
Uses your local SSH key and allows you to SSH using:
ssh ec2-user@<node-public-ip>
Only hosts in this security group can SSH into the nodes.
bash
CopyEdit
aws ssm start-session --target <instance-id>
🛠 Note: You must install SSM Agent, configure IAM role permissions, and have internet or VPC endpoints for
SSM to work.
❗ Important Rules
You must choose only one among: publicKeyPath, publicKey, or publicKeyName.
allow: true must be set for any SSH config to take effect.
For managed node groups, SSH access is only possible if the AMI allows it (Amazon EKS optimized
AMIs do).
For SSM, ensure:
o EC2 IAM role has SSM permissions.
o Outbound access to the internet or SSM VPC endpoints exists.
o Port 22 is not required.
🔒 Security Tip
For production clusters, prefer enableSsm: true over SSH to avoid opening port 22 and reduce your attack
surface.