Finding compute node group instances in AWS PCS
Each AWS PCS compute node group can launch EC2 instances with shared configurations. You can use EC2 tags to find instances in a compute node group in the AWS Management Console or with the AWS CLI.
- AWS Management Console
-
To find your compute node group instances
-
Open the AWS PCS console
. -
Select the cluster.
-
Choose Compute node groups.
-
Find the ID for the login node group you created.
-
Navigate to the EC2 console
and choose Instances. -
Search for the instances with the following tag. Replace
node-group-id
with the ID (not the name) of your compute node group.aws:pcs:compute-node-group-id=
node-group-id
-
(Optional) You can change the value of Instance state in the search field to find instances that are being configured or that were recently terminated.
-
Find the instance ID and IP address for each instance in the list of tagged instances.
-
- AWS CLI
-
To find your node group instances, use the commands that follow. Before running the commands, make the following replacements:
-
Replace
with the AWS Region of your cluster. Example:region-code
us-east-1
-
Replace
with the ID (not the name) of your compute node group.node-group-id
-
Replace
running
with other instance states such aspending
orterminated
to find EC2 instances in other states.
aws ec2 describe-instances \ --region
region-code
--filters \ "Name=tag:aws:pcs:compute-node-group-id,Values=node-group-id
" \ "Name=instance-state-name,Values=running
" \ --query 'Reservations[*].Instances[*].{InstanceID:InstanceId,State:State.Name,PublicIP:PublicIpAddress,PrivateIP:PrivateIpAddress}'The command returns output similar to the following. The value of
PublicIP
isnull
if the instance is in a private subnet.[ [ { "InstanceID": "i-0123456789abcdefa", "State": "running", "PublicIP": "18.189.32.188", "PrivateIP": "10.0.0.1" } ] ]
Note
If you expect
describe-instances
to return a large number of instances, you must use options for multiple pages. For more information, see DescribeInstances in the Amazon Elastic Compute Cloud API Reference. -