DEV Community

Cover image for Why Your AI Agent Should Never See ~/.aws/credentials Again
Sascha Mirow-Stanitzok
Sascha Mirow-Stanitzok

Posted on Originally published at sascha-ms.de

Why Your AI Agent Should Never See ~/.aws/credentials Again

Last week I watched an AI agent on my laptop grep through my home directory looking for a config value. It found what it needed. It also walked right past ~/.aws/credentials – a file that, on many developer machines, still holds a long-term IAM access key in plaintext. Nothing bad happened. But nothing would have stopped it either.

That is exactly the gap the new AWS Credential Daemon wants to close. It was released on December 1, 2026 as an open-source preview, and I wrote a detailed hands-on guide to the AWS Credential Daemon on my site. Here is the condensed story of why it matters and what I learned setting it up.

The problem: secrets as files, agents with your permissions

Static credentials on disk were always a risk, but it used to feel theoretical. Today I start agents several times a day that read files, run commands and install packages. A prompt injection hidden in a web page, an unlucky prompt or a compromised npm package is enough for the contents of a config file to land in a model's context window or someone else's log.

Even IAM Identity Center leaves a token in ~/.aws/sso/cache. And there is a second, quieter issue: agents usually run with your profile. If you are admin in the dev account, so is the agent.

How the daemon changes the picture

The tool consists of two parts: credsd, a background service (systemd on Linux, LaunchAgent on macOS), and creds, the client. Only the daemon touches the keystore. Long-lived secrets – SSO sessions, IAM access keys, Roles Anywhere keys – are sealed with AES-256-GCM under a master key that lives in a TPM 2.0, the macOS keychain or, as the weakest fallback, a file.

What I like most: it does not invent a new protocol. It plugs into credential_process, which every AWS CLI and SDK version already understands. Your profile simply calls the client, and the client returns short-lived credentials as JSON:

# ~/.aws/config
[profile work]
region = eu-central-1
credential_process = /usr/local/bin/creds get --credential work --format credential-process
Enter fullscreen mode Exit fullscreen mode

Because of that, Terraform, CDK, the Serverless Framework and your existing Node code keep working without changes. Two details tripped me up, though: the command runs without a shell (so no ~ or $HOME, use the absolute path), and leftover keys in ~/.aws/credentials or AWS_* environment variables take precedence and silently bypass the daemon.

The real win: a dedicated, scoped profile for agents

Encrypting secrets is nice. Giving agents fewer permissions is what actually reduces risk. The daemon lets you create a separate credential marked as an agent identity, backed by a weaker role, and attach a boundary policy that narrows every session it hands out. Tightening a boundary is free; loosening or removing it requires approval via Touch ID or sudo. That asymmetry is exactly right.

You then start the agent with that profile, and with the --agentic flag the daemon records the caller as an agent in its audit trail. For single tasks you can narrow things further per request.

Where the limits are

I want to be honest here, because the project documentation is too: any code running as your user can ask the daemon for credentials over its socket, just like creds does. An agent with shell access can call it directly. So the daemon removes copyable secrets from disk – it does not replace user separation, containers or sandboxes. Root can still reach the keys, there is deliberately no export, and as a preview, commands and formats may still change. Windows is not supported yet.

My conclusion: scope your roles first, then put the daemon in front. An agent with an admin profile is just as dangerous with the daemon as without it – minus the plaintext file.

What the full article covers

  • Step-by-step installation on Linux (TPM) and macOS, including signature verification
  • Bootstrapping IAM Identity Center and importing old static keys with a dry run
  • A complete boundary policy example and the agent profile configuration
  • A TypeScript check with the AWS SDK v3 plus a table of common setup errors and fixes
  • FAQ on costs, TPM requirements and uninstalling

Read the full guide here: AWS Credential Daemon: no more plaintext access keys

📖 This is the condensed version. The full article on sascha-ms.de goes deeper – with all code samples, diagrams and a short knowledge check.


👉 Next step: Working with AWS CDK? Grab my printable AWS CDK cheat sheet with commands, concepts and a stack skeleton.

📬 Stay updated: New articles on serverless, AI and leading tech teams via RSS, browser push or the weekly newsletter (in German).

Originally published on sascha-ms.de. More articles on serverless, AI in everyday development and leading tech teams: sascha-ms.de/en

Top comments (0)