It is quite convenient to use the AWS Config advance queries against the aggregator, a simple use case is like – Find out which instances in which accounts have public IP address cross the organisation.
Instead of writing a script to describe instances across all the accounts, we can just simply run the following query in AWS config console.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The results can be exported in json or csv format. Just bear in mind that the query results are paginated. When you choose export, up to 500 results are exported.
The query can be run in AWS CLI as well:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export query="SELECT accountId, configuration.instancdId, configuration.publicIp, configuration.ipv6Addresses WHERE resourceType = 'AWS::EC2::Instance' AND (configuration.publicIp BETWEEN '0.0.0.0' AND '255.255.255.255' OR configuration.ipv6Addresses BETWEEN '0:0:0:0:0:0:0:0' AND 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff')"
One thought on “AWS Config Advance Queries against Aggregator sample”