Cloud & infrastructure
AWS
Connect an AWS account read-only via CloudFormation or Terraform, with optional just-in-time write elevation.
AWS connects by creating an IAM role Dave assumes, with either a CloudFormation stack or a Terraform command. No access keys are stored.
Connect
Section titled “Connect”-
In the AWS Console, open the account menu (top right) and copy your 12-digit Account ID. It is also in any role ARN. You need the rights listed below.
-
In Dave, go to Integrations → Add integration → AWS.
-
Paste the AWS Account ID and pick the Primary region — the region you work in, and the one your organization allows stacks in.
-
Set a Label — see labels.
-
Leave Enable agentic JIT (advanced) off unless you want write elevation.
-
Under How do you want to create the roles?, choose one:
- Managed (AWS CloudFormation) — choose Open AWS console for a prefilled stack, check the console’s account and region match the ones you entered, then deploy it.
- Self-managed (Terraform) — you need Terraform 1.3 or later, and AWS credentials
for the account that can create IAM roles. Choose Connect AWS Account, copy the
command and paste it into a terminal.
The command writes a
main.tfthat uses Dave’s Terraform module into aDaveAgent-xxxxxxxxfolder and runsterraform apply, which shows the plan and waits for you to confirm. It refuses to run against any other account, and it pins the module by its checksum, so Terraform refuses any copy that differs.terraform initdownloads the module from Dave’s release bucket (dave-byoc-prod-templates.s3.amazonaws.com) and the AWS provider fromregistry.terraform.io, so the machine you run it on must reach both.
-
Dave finishes connecting once the role exists — keep the Dave tab open. If the account already has the integration roles, either way connects at once, with no setup step.
If you run Dave in your own cloud
Section titled “If you run Dave in your own cloud”With Dave BYOC, your tenant service assumes the roles, not Dave, so:
- Install Dave BYOC and wait for its tenant service to connect before you connect AWS. Dave fills the tenant service’s role into both the stack and the Terraform command, and the roles trust only that role.
- The AWS account can be the one Dave BYOC runs in or any other account you run.
Connect many accounts with your own Terraform
Section titled “Connect many accounts with your own Terraform”To manage the roles of many accounts in one place, apply Dave’s module once in every account with your own Terraform or Terragrunt, using that account as the provider. Then connecting an account in Dave takes no setup step:
- In Add integration → AWS, choose Self-managed, and copy the block under
Apply it once in every account. It uses the integration role names (
DaveAgent-integration-role) and your tenant’s own external ID, the same for every account. Tick Enable agentic JIT first if you want it: the block then setsenable_elevated_role = true. - Add that block to your Terraform for each account, and apply.
- Connect each account in Dave with Self-managed: Dave finds its roles as soon as you enter the account ID, and the connection completes in a few seconds. An account you already started to connect with Self-managed completes too, on Check connection.
With Dave BYOC, the block trusts your tenant service instead of Dave, so install Dave BYOC and wait for its tenant service to connect before you copy it. Everything else is the same.
To remove an account, destroy its roles in your Terraform, then disconnect it here.
Terragrunt or an existing Terraform repository
Section titled “Terragrunt or an existing Terraform repository”To manage the roles with the rest of your infrastructure, use the module from the
Terraform command in your own code instead of running the command. Copy the
module "dave" block into your Terraform, or, with Terragrunt, use its source and
inputs in a unit:
include "root" { path = find_in_parent_folders("root.hcl")}
terraform { source = "<source from the Terraform command>"}
inputs = { stack_name = "DaveAgent-xxxxxxxx" external_id = "<external_id from the Terraform command>" enable_elevated_role = false
# The one the Terraform command has: trusted_account_id, or, if you run Dave in your # own cloud (BYOC), trusted_principal_arn. trusted_account_id = "<trusted_account_id from the Terraform command>"}Keep the source exactly as the command shows it, including its ?checksum=sha256:…
part, and the trust input it has: with Dave BYOC, trusted_principal_arn makes the
roles trust your tenant service instead of Dave’s account. Your own provider configuration and remote state apply. The module ships in a
Dave BYOC release (dave-byoc-<version>.zip, folder
modules/dave-byoc/modules/aws-integration-role): a published release never changes,
so your roles only change when you move to a newer one. The module outputs role_arn and
elevated_role_arn, and takes the optional inputs in
Narrow what Dave can do.
Permissions
Section titled “Permissions”The stack (or Terraform folder) is named DaveAgent- followed by eight characters of
the connection ID, and the stack is created in the primary region you picked. Both
create the same roles: one, plus a second only if you enable agentic JIT. IAM roles
are global, so Dave can read every region in the account; the primary region is just
where commands run by default.
Read role
Section titled “Read role”Role name: DaveAgent-xxxxxxxx-role. Attached AWS managed policy:
arn:aws:iam::aws:policy/ReadOnlyAccessInline policy DaveSelfInspection, so Dave can check what its own role is allowed
to do:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": ["iam:SimulatePrincipalPolicy"], "Resource": "*" } ]}Trust policy
Section titled “Trust policy”Both roles trust only Dave’s AWS account, and only with the external ID unique to this connection, which protects against the confused-deputy problem:
{ "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::<Dave account ID>:root" }, "Action": "sts:AssumeRole", "Condition": { "StringEquals": { "sts:ExternalId": "<external ID>" } }}If you run Dave in your own cloud, both roles instead trust only your Dave tenant
service’s IAM role, still with the external ID, and also let that role tag its
session (sts:TagSession), which its EKS Pod Identity session needs. Dave’s own
account is not trusted at all. Both roles carry the tag dave.io/integration =
true, because the tenant service may assume only roles with that tag.
Elevated role
Section titled “Elevated role”Created only when Enable agentic JIT (advanced) is on. Role name:
DaveAgent-xxxxxxxx-elevated-role, maximum session duration one hour. Attached AWS
managed policy:
arn:aws:iam::aws:policy/PowerUserAccessPowerUserAccess is the ceiling, not what Dave gets. Dave assumes this role only
after a human approves a specific action, with an inline session policy limited to
that action, for 15 minutes. You can replace the managed policy on the role with a
narrower one (with Terraform, through elevated_role_policy_arns); the session
policy always narrows it further.
Who can connect
Section titled “Who can connect”Whoever deploys the stack needs rights to create CloudFormation stacks and IAM roles in the account. With Terraform, rights to create IAM roles are enough.
For security reviews
Section titled “For security reviews”What Dave creates and holds
Section titled “What Dave creates and holds”The stack or module creates only the roles above, in your account, and nothing else. Dave stores no AWS access keys: it assumes a role for short-lived credentials when it needs them. If you run Dave in your own cloud, your tenant service assumes the roles and Dave never receives credentials for them.
Narrow what Dave can do
Section titled “Narrow what Dave can do”The defaults match the CloudFormation stack. With Terraform you can narrow them without changing the module:
| Input | Default | What it does |
|---|---|---|
enable_elevated_role |
false |
Leave it off and Dave cannot write to the account at all. |
read_role_policy_arns |
ReadOnlyAccess |
Managed policies on the read role. ReadOnlyAccess reads data, such as S3 objects, as well as configuration; ViewOnlyAccess, for example, lists and describes resources without reading their data. Attach only read-only policies. |
elevated_role_policy_arns |
PowerUserAccess |
Managed policies on the write role: the ceiling for any approved command. |
permissions_boundary_arn |
none | A permissions boundary on both roles: the most Dave can ever do here, whatever their policies. It must allow iam:SimulatePrincipalPolicy, which Dave uses to check its own role. |
The module checks its inputs before it plans: account IDs, role and policy ARNs, and the external ID must have the right form.
Verify the module
Section titled “Verify the module”The Terraform command pins the module by its SHA-256, and Terraform checks it on
download. To review the code before you run it, or to keep a copy in your own
repository, download the zip from the command’s source (the part before //),
check it with shasum -a 256 dave-byoc-<version>.zip against the checksum in that
source, and reference its modules/dave-byoc/modules/aws-integration-role folder
by path. Terraform state holds the role ARNs and the trust
policy with its external ID; it holds no credentials.
Manage the connection
Section titled “Manage the connection”Everything Dave can do lives in the stack or the Terraform folder. To review or
remove a stack, open CloudFormation → Stacks in the stack’s region and find
DaveAgent-xxxxxxxx; its Resources tab lists the roles. Either way, you can also
find them under IAM → Roles by searching DaveAgent-.
Disconnect in Dave stops Dave using the role immediately, but does not delete anything in AWS — Dave cannot delete its own role. While the connection is disconnecting, it shows what to remove for the way you set it up:
- Managed: Open the provider console takes you to the stack; delete it there.
- Self-managed: run the command shown (
terraform destroyin theDaveAgent-xxxxxxxxfolder); if that folder is gone, delete theDaveAgent-xxxxxxxx-*roles in IAM. - Integration roles: remove the
module "dave"block for that account from your Terraform and apply it.
The connection stays Disconnecting until the role is gone, then Dave confirms it is fully disconnected.
Cancelling an unfinished setup works the same way: if the stack or Terraform already deployed, remove it.
Just-in-time elevation
Section titled “Just-in-time elevation”Enable agentic JIT (advanced) creates a separate write-capable role. Every elevated action still requires explicit human approval, and leaving the option off keeps the account genuinely read-only — the elevated role is never created. See Elevated role for what it can do.
Troubleshooting
Section titled “Troubleshooting”- The console does not open — allow popups for Dave, or use Open the provider console on the connection.
- Stack creation takes long — check the stack in the AWS Console reached
CREATE_COMPLETE. - AWS rejects the connection — confirm the stack or Terraform deployed in the account you entered, then choose Connect again. If the role still cannot be assumed, Dave offers the same setup step again; it is safe to rerun.
- Your cloud is unreachable, or Your cloud has not reported its Dave tenant service yet — with Dave BYOC, Dave cannot reach your tenant service, or it has not finished connecting. Check its status in Settings → Bring your own cloud, then connect again.
- Terraform stops with an account error — your credentials point at a different account than the one you entered. Switch credentials and rerun.