使用 AWS System Manager 提取弹性 IP 和实例名称列表 [英] Extract a list of Elastic IPs and Instance Names using AWS System Manager
本文介绍了使用 AWS System Manager 提取弹性 IP 和实例名称列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 AWS 云环境中,我必须获取具有实例名称和所有区域/可用区(如 eu-west-1、eu-west-3、ap-south-1、us-east-)的所有弹性 IP 的列表1 等.
In the AWS Cloud Environment i have to the get list of all Elastic IPs with instance name and in all region/AZs like eu-west-1 , eu-west-3, ap-south-1, us-east-1 etc..
如果可能,如何通过 AWS 系统管理器实现这一点.如果没有,那么我是否必须编写任何其他函数/代码或使用其他 AWS 功能.
How this can be achieved via AWS System manager if possible. If not, then do i have to write any other function/code or use other AWS functionality.
推荐答案
我会通过以下步骤编写程序(例如在 Python 中)来实现:
I would do it by writing a program (eg in Python) with these steps:
- 使用
describe_regions()
- 使用
describe_addresses()
- 从响应中提取
InstanceId
和PublicIp
- 调用
describe_instances()
为给定的InstanceId
获取标签列表.实例名称"存储为带有Key = 'Name'
的标签
- Loop through each (applicable) Region using
describe_regions()
- Loop through each Elastic IP address using
describe_addresses()
- Extract the
InstanceId
andPublicIp
from the response - Call
describe_instances()
for the givenInstanceId
to obtain a list of Tags. The "instance name" is stored as a Tag withKey = 'Name'
这篇关于使用 AWS System Manager 提取弹性 IP 和实例名称列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
- Extract the
- Loop through each Elastic IP address using
- 从响应中提取
- 使用
查看全文