Gather data from multiple AWS orgs into the same database with CloudQuery
Hey there! We are gathering data from one AWS organization into a Postgres DB with CloudQuery, and we want to extend this to cover an additional AWS org. I’m not sure how we can achieve this. Currently, we use the credentials of the role attached to the EC2 instance we use to run CloudQuery, and CloudQuery uses that role to list the accounts in the org.
Hi @certain-alpaca - The best way to do this is to create a trust relationship between a role in the admin account of the new AWS Org and the role attached to the EC2 instance.
So CloudQuery leverages the instance profile role. If I point to the role ARN in the new org, I will lose that, I guess. I’m not sure how to make both things coexist.
Also, when it comes to the tables in Postgres, I’d like to have a way to distinguish the tables of one org versus the tables from another. What’s the best way to do this? Another database? Another schema?
So if you are using the default credentials on the AWS EC2 instance, CloudQuery will automatically use those credentials when assuming a role.
If you want each org to have separate tables, then the best way to do that is to use different schemas. You can easily switch the schema in your Postgres destination by setting the search_path in your connection string:
The AWS Org integration works by assuming a role in the management account or root of the org and running ListAccounts to enumerate all of the accounts and then assuming a role in each one to actually run the sync.
If you want to hop on a 15-minute call to discuss how this might work for your organization(s), feel free to schedule a meeting on my calendar: Schedule a Meeting
Sorry, I was out on vacation. That makes sense, I’ll try that, and if I’m not able to make it work, I’ll schedule a 15-minute call with you as suggested. Thanks!
Hi! The approach you suggested worked like a charm. I’m trying to figure out now if CloudQuery is able to target specific OUs only. I didn’t see any reference to that in the docs; is that feature available?