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.
Short answer
Use a cross-account IAM role. SnoozeDB generates a CloudFormation template that creates
SnoozeDBAccessRole in your account. Its trust policy only allows SnoozeDB's AWS account to call sts:AssumeRole when it presents your unique External ID. Credentials are temporary and expire automatically. Delete the stack to revoke access.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 SnoozeDBAccessRolePermissions 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>