How do you get the private IP address of the eth1 network interface on an Amazon EC2 instance?

0

I've attached multiple elastic network interfaces to an Amazon EC2 instance, and I need get the private IP address of the eth1 network interface. What command(s) do I need to run to get it?

AWS
질문됨 4년 전2850회 조회
1개 답변
0
수락된 답변

To get the private IP address of an Amazon EC2 instance, you can use either of the following describe-instances AWS CLI commands:

Important: Replace <instance-id> with your Amazon EC2 instance's ID. Replace <your-private-dns-name> with the private DNS name of the network interface.

aws ec2 describe-instances --instance-id <instance-id> --query 'Reservations[0].Instances[0].NetworkInterfaces[?Attachment.DeviceIndex==`1`].PrivateIpAddress'

-or-

aws ec2 describe-instances --filters Name=private-dns-name,Values=<your-private-dns-name> --query 'Reservations[0].Instances[0].NetworkInterfaces[?Attachment.DeviceIndex==`1`].PrivateIpAddress'
AWS
답변함 4년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠