Docs/How do I give a cost tool access to AWS without sharing access keys?

How do I give a cost tool access to AWS without sharing access keys?

Grant a third-party tool scoped AWS access with a cross-account IAM role, External ID, and temporary STS credentials, then verify and revoke it from the CLI.

What the trust policy looks like

{
  "Effect": "Allow",
  "Principal": { "AWS": "arn:aws:iam::<snoozedb-account-id>:root" },
  "Action": "sts:AssumeRole",
  "Condition": { "StringEquals": { "sts:ExternalId": "<your-unique-external-id>" } }
}

The External ID prevents the confused deputy problem: another SnoozeDB customer cannot make SnoozeDB assume your role.

Inspect the role

aws iam get-role \
  --role-name SnoozeDBAccessRole \
  --query 'Role.AssumeRolePolicyDocument'

aws iam list-role-policies --role-name SnoozeDBAccessRole

Permissions cover the AWS control plane: describe, start, stop, and tag resources for the modules you enabled. They do not allow reading database contents, deleting instances or snapshots, or buying Reserved Instances or Savings Plans.

Revoke access

aws cloudformation delete-stack --stack-name <your-snoozedb-stack-name>