大网数据广告活动
服务器运维问答

Is it possible to get aws ec2 instance id based on its IP address

· 52CE 我爱测

I have list of IP addressed, I want to find if instances associated with the IP address are still running or terminated. I am launching and terminating lot of instances on daily basis, just want to remove their certificates from …

问题原文

原帖链接 · Ramesh Kumar · CC BY-SA 3.0

I have list of IP addressed, I want to find if instances associated with the IP address are still running or terminated. I am launching and terminating lot of instances on daily basis, just want to remove their certificates from puppetmaster.

If there is any alternative method, I can achieve my goal, I can do that.

已采纳解答

原帖链接 · Jamie W · CC BY-SA 3.0

aws ec2 describe-instances --filter Name=ip-address,Values=IP_1,..IP_N

Should do what you need.

use the filter name of private-ip-address to select using private address in your VPC.

Pipe through something like

jq -r '.Reservations[].Instances[] | .InstanceId, .PublicIpAddress'

if you want the corresponding InstanceID

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2015-08-05)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。