【问题标题】:Find out which port number an RDS Security Group is attached with?找出 RDS 安全组附加到哪个端口号?
【发布时间】:2015-06-18 08:56:33
【问题描述】:

我想知道 RDS 安全组连接到哪个端口号。

security_groups = rds_conn.get_all_dbsecurity_groups()
for sg in security_groups:
    print sg
    for ip_range in sg.ip_ranges:
        #Report which port this is attached to

【问题讨论】:

  • 那么你的问题是什么?
  • 我找不到连接到该安全组的端口号。

标签: python amazon-web-services boto rds


【解决方案1】:

离开之前的解决方案。试试这个

security_groups = rds_conn.get_all_dbsecurity_groups()
for sg in security_groups:
    for r in sg.rules:
        print rule.ip_protocol, rule.from_port, rule.to_port, rule.grants

【讨论】:

  • 如何从中提取端口号??
  • @upaangsaxena 不要考虑 v1 或 v2 就离开它。只需编辑您以前的代码。
  • 我收到一个错误,即规则不存在。而且,它也没有在调试模式下显示。
  • @upaangsaxena 对于我的数据库实例,它使用 vpc 安全组,即 ec2 安全组。让我知道您是否有单独的 rds 安全组?
  • 显示错误:for r in sg.rules: AttributeError: 'DBSecurityGroup' object has no attribute 'rules'
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-12-24
  • 2016-01-23
  • 2015-12-10
  • 2020-08-25
  • 2017-10-05
相关资源
最近更新 更多