Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

251
Vistas
Retrieving the private IP addresses in a subnet in AWS

Is there an easy way to have all the private IP assigned in a particular subnet with the AWS command line?

I want to give in as my input the subnet ID, ie. subnet-0ca0b01xxxxxxxxxx and the output should the list of all the private IPs assigned in the subnet. Thanks.

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

You can use the command below:

aws ec2 describe-instances --filters "Name=subnet-id,Values=**YourSubnetID**" --query 'Reservations[*].Instances[*].PrivateIpAddress' --output text
over 4 years ago · Santiago Trujillo Denunciar

0

The previous solution only returns the private IPs for your EC2 instances, but what about your RDS/ElastiCache instances or any other AWS resource that uses a private IP? You actually need to use the describe-network-interfaces command.

This will return all the private IP addresses for a single or multiple subnet-ids:

aws ec2 describe-network-interfaces --filters Name=subnet-id,Values=subnet_id_1,subnet_id_2 --query 'NetworkInterfaces[*].PrivateIpAddress'

But the previous command it's not going to work for all cases either. For example, I'm running multiple EKS clusters at AWS, the VPC CNI plugin for Kubernetes can allocate multiple private IPs for a single Elastic Network Interface In such scenarios this is what you need to use, it's slightly different:

aws ec2 describe-network-interfaces --filters Name=subnet-id,Values=subnet_id_1,subnet_id_2 --query 'NetworkInterfaces[*].PrivateIpAddresses[*].PrivateIpAddress'
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda