【问题标题】:AWS : How to filter RDS Global Cluster name using QUERYAWS:如何使用 QUERY 过滤 RDS 全局集群名称
【发布时间】:2021-07-21 14:42:16
【问题描述】:

我想在不使用 --global-cluster-identifier 选项的情况下查询 AWS RDS 全局集群,因为在我的自动化中,我的代码不知道标识符,所以我想使用 Engine 获取集群名称并过滤 GlobalClusterIdentifer 是否它是否包含给定的值。

这是我的 cli 命令,它显示 EngineGlobalClusterIdentifer。如何使用 --query 选项并完成它。

aws rds describe-global-clusters --query 'GlobalClusters[].Engine' --output text

aws rds describe-global-clusters --query 'GlobalClusters[].GlobalClusterIdentifer' --output text

所以我需要的是,我想查询引擎类型是 aurora-postgresql 并获取过滤引擎的 GlobalClusterIdentfier。

有人可以帮我解决这个问题吗?

【问题讨论】:

    标签: amazon-web-services amazon-rds aws-cli


    【解决方案1】:

    您应该可以使用以下内容

    aws rds describe-global-clusters --query 'GlobalClusters[?Engine==`aurora-postgresql`].GlobalClusterIdentifier
    

    【讨论】:

    • 如果我需要在GlobalClusterIdentifer 上查找特定上下文怎么办?比如说,我只想过滤DEV,我们该怎么做?
    • 不确定上下文是什么意思?如果您的意思是GlobalClusterIdentifier 必须在其中包含字符串DEV,您可以尝试类似aws rds describe-global-clusters --query 'GlobalClusters[?Engine==`aurora-postgresql`] | [?contains(GlobalClusterIdentifier, `DEV`)].GlobalClusterIdentifier' 的方法,这将为您提供engine=aurora-postgresql 集群并在其标识符中包含字符串DEV .
    猜你喜欢
    • 2019-05-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-15
    • 2021-01-30
    • 2022-11-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多