Closed chelma closed 1 year ago
After looking at the code/docs, here's a tentative plan-of-action for this:
vpc-add
needs to be called using the source account's credentials. We could solve this by providing cross-account permissions to hit the VNI store, which is currently just two Param values. Alternatively, would could issue a block of VNIs to each source account, or something like that. Either way, we can do this set up during the account-account registration CLI calls.Additional consideration - we have some commands (like clusters-list
) which should continue to operate normally when called on the capture account. This means we'll need to update our data store to somehow link the source/capture accounts in the capture account data store. Practically, this probably means that when we perform the registration dance we'll register a specific source VPC/account with the capture account rather than a capture account as a whole. This has the side benefit of also scoping down the whitelists we're applying to our GWLB.
Thinking about this more, we have a couple different approaches we can take with the data store.
One is to allow source accounts to interact with a central data store in the capture account. This will (likely) require the least number of code changes, simplifies some architecture decisions, and is a well-supported AWS paradigm. The flipside is that we'll need to be able to reasonably scope down the cross-account permissions. Ideally, we'd scope the permissions to an explicit list of actors in the source account but I think that will be quite burdensome in-practice. As a result, we'll probably grant the root principal of the source account perms to perform very limited actions on very limited resources.
The other approach is to bulkhead the two accounts. In the short term, this would require a lot more thought about precisely how to accomplish this effectively but would limit (or even eliminate) the need for cross-account data store calls. In the longer term, I believe this will have on ongoing impact on design avenues - which may be a good thing, and may not. It will likely create substantially more friction for users and be more complex to operate, but maybe we really do want to treat these accounts as separate entities.
Another consideration (somewhat) tied to this decision is how to handle multiple actors acting on the data store at the same time. We currently assume there's only one actor performing cluster-level operations at a given time, but that may not always be the case. The problem presents itself for both conjoined and bulkheaded accounts, but seems worth bringing up.
Overall, I think the right decision (for now) is to allow cross-account data store operations, as it feels like we can scope the permissions down pretty tightly in terms of operations/resources and seems to provide a better user experience. It's possible that some users need the bulkhead approach, but we don't have positive data points in that direction yet and can pivot later if needed.
It appears going the cross-account access route makes this fairly straightforward. Here's an updated plan of action, in the order a user would invoke them:
cluster-register-vpc
CLI command
vpc-associate-with-cluster
CLI command the user needs to run nextvpc-register-cluster
CLI command
vpc-add
and vpc-remove
assume-role
; other operations remain the same and use an in-account AWS Clientclusters-list
vpc-deregister-cluster
CLI command
cluster-deregister-vpc
CLI command
Overall, the cross-account user workflow would be:
cluster-create
using capture account credentialscluster-register-vpc
using capture account credentialsvpc-register-cluster
using source account credentialsvpc-add
using source account credentialsvpc-remove
using source account credentialsvpc-deregister-cluster
using source account credentialscluster-deregister-vpc
using capture account credentialscluster-destroy
using capture account credentialsThe same-account workflow would remain unchanged:
cluster-create
using capture account credentialsvpc-add
using capture account credentialsvpc-remove
using capture account credentialscluster-destroy
using capture account credentialsPR posted for the vast majority of the work. Remaining effort:
clusters-list
to work correctly w/ cross-account VPCsclusters-deregister-vpc
to remove GWLBE creation perms if there's no other VPCs using the,OK, so - clusters-list
currently finds which VPCs are being monitored by looking for Parameter Store entries of the form /arkime/clusters/<cluster name/vpcs/<vpc id>
. That entry is created by the CloudFormation stack that spins up the VPC-specific resources, which means in the cross-account scenario it isn't present in the Cluster account because that stack is created in the VPC account. This means we can either create a duplicate entry in the Cluster account or do a cross-account call from the Cluster account. The later option seems like the better approach to avoid additional bookkeeping but we'll need to make a new cross-account role the Cluster Account can use to get access to the VPC account (easy).
Plan of attack:
vpc-register-cluster
to create a cross-account role the Cluster account can use to access Param Store in the VPC accountvpc-deregister-cluster
to delete that cross-account roleclusters-list
to check for cross-account Param Store link entries and pull VPC details (e.g. VNI) from the VPC account when it finds themPR posted to cover the remaining work; task should be complete after it is merged.
PRs merged; acceptance criteria met. Resolving.
Description
This task is to update the AWS-AIO repo so that it's possible to perform cross-account capture (the GWLBE is in a different account than the GWLB).
See here for an explanation of how this will work: https://github.com/arkime/aws-aio/issues/109#issuecomment-1682526890
Acceptance Criteria