使用JQ在aws中获取具有安全组,名称和ENI ID的资产的csv列表,以便从JSON跟踪VPC流

您需要使用aws ec2 describe实例来获取JSON文件。
.

0

linux命令:cat aws.json | jq -r '.Reservations[].Instances[] | [.PrivateIpAddress, .SecurityGroups[].GroupId,.SecurityGroups[].GroupName,.NetworkInterfaces[].NetworkInterfaceId,(.Tags[] | select(.Key =="Name") | .Value),([.InstanceId| tostring] | join(";"))]|@csv' join(";"))]|@csv' | tostring] .Value),([.InstanceId| | =="Name") select(.Key | .SecurityGroups[].GroupId,.SecurityGroups[].GroupName,.NetworkInterfaces[].NetworkInterfaceId,(.Tags[] [.PrivateIpAddress, | '.Reservations[].Instances[] -r jq | aws.json cat cat aws.json | jq -r '.Reservations[].Instances[] | [.PrivateIpAddress, .SecurityGroups[].GroupId,.SecurityGroups[].GroupName,.NetworkInterfaces[].NetworkInterfaceId,(.Tags[] | select(.Key =="Name") | .Value),([.InstanceId| tostring] | join(";"))]|@csv'rootopen.com
linux命令:cat aws.json | jq -r '.Reservations[].Instances[] | [.PrivateIpAddress, .SecurityGroups[].GroupId,.SecurityGroups[].GroupName,.NetworkInterfaces[].NetworkInterfaceId,(.Tags[] | select(.Key =="Name") | .Value),([.InstanceId| tostring] | join(";"))]|@csv' join(";"))]|@csv' | tostring] .Value),([.InstanceId| | =="Name") select(.Key | .SecurityGroups[].GroupId,.SecurityGroups[].GroupName,.NetworkInterfaces[].NetworkInterfaceId,(.Tags[] [.PrivateIpAddress, | '.Reservations[].Instances[] -r jq | aws.json cat cat aws.json | jq -r '.Reservations[].Instances[] | [.PrivateIpAddress, .SecurityGroups[].GroupId,.SecurityGroups[].GroupName,.NetworkInterfaces[].NetworkInterfaceId,(.Tags[] | select(.Key =="Name") | .Value),([.InstanceId| tostring] | join(";"))]|@csv'rootopen.com
zvvl 2018-08-10 22:12:23
输出
"1.1.1.1","sg-9bc42fed","private-my-groupname","eni-81519d01","qa-myserver-1.pholem-earth.com","i-0129e27fa464a213c"
"2.2.2.2","sg-93b42b1c","another-security-group","eni-31c53b29","gc-myadmin-server-2.pholem-earth.com","i-0b5ac9579a692f987"

评论

相关推荐
共收录0条命令行
这里是记录和分享命令行的地方, 所有命令行都可以进行评论、提交替代方案.

热门文章