AWS ConfigService - 如何附加账户 ID

AWS ConfigService- how to append account IDs

我正在尝试附加帐户 ID 列表,因为我无权访问组织,但每当我这样做时,以前的帐户都会被新帐户 ID 替换,我只想附加它们。 请告诉我该怎么做。

aws configservice put-configuration-aggregator --configuration-aggregator-name test-config --account-aggregation-sources "[{\"AccountIds\": [\"xxxxxx\",\"xxxx\"],\"AwsRegions\": [\"us-east-1\"]}]"

来自文档

accountIds that are passed will be replaced with existing accounts. If you want to add additional accounts into the aggregator, call DescribeAggregator to get the previous accounts and then append new ones.

参考资料: https://awscli.amazonaws.com/v2/documentation/api/latest/reference/configservice/put-configuration-aggregator.html

所以你可以先调用 DescribeAggregator1 来获取以前的帐户并将它们存储在某个变量中。 然后通过 jq.

将新帐户附加到以前的帐户变量

注意 - 我已经添加了 AWS CLI V2 的链接。