Nov 18, 20267 min read

AWS Secrets Manager vs HashiCorp Vault

How AWS Secrets Manager and HashiCorp Vault compare on storing, rotating and issuing secrets for backend services, what each costs to run, and how application secrets can stay out of the repository and out of reach of coding agents.

Illustration for AWS Secrets Manager vs HashiCorp Vault

AWS Secrets Manager is the default place to put a database password or a Stripe key once an app runs on AWS: a secret is a named value, IAM decides who can read it, and a Lambda function can rotate it on a schedule. It starts to feel thin when you want credentials that are created on demand and expire after an hour, a private certificate authority, or one secrets system across AWS, GCP and a data center.

HashiCorp Vault was built for exactly those cases, and it brings a cluster to run, unseal and upgrade. This guide compares the two on secret storage, rotation and dynamic secrets, access control, operations and cost, and covers where application secrets should live so they never end up in the repository.

Secrets Manager vs Vault at a Glance

EncoreAWS Secrets ManagerHashiCorp Vault
What it isTyped secrets declared in application codeManaged secret storage in AWSSelf-hosted or HCP-managed secrets platform
Where values liveEncrypted in Encore's vault, replicated to Secrets Manager or GCP Secret Manager in your accountYour AWS account, encrypted with KMSVault's storage backend, encrypted with Vault's keys
Access controlEach service reads only the secrets it declaresIAM policies and resource policiesVault policies and auth methods
RotationSet a new value, services pick it up on restartManaged rotation for RDS and others, Lambda for customDynamic secrets with leases and revocation
Kept out of the repoProduction values are never in the code; a local .secrets.local.cue override is readable if presentYesif the code fetches at runtimeYesif the code fetches at runtime
OperationsNoneNoneCluster, storage, unsealing, upgrades
PricingSecret manager charges in your own cloud account$0.40 per secret per month plus API callsInfrastructure for Community, licenses for Enterprise or HCP

Storing and Reading Secrets

Secrets Manager stores a string or JSON value per secret, encrypted with a KMS key, versioned with staging labels such as AWSCURRENT and AWSPREVIOUS. Applications read it with GetSecretValue, usually through a caching client or the ECS integration that injects secrets into a task's environment at start. Secrets can be replicated to other regions for multi-region apps.

Vault's KV secrets engine stores versioned key-value secrets at paths, and applications authenticate first, using a method such as AWS IAM, Kubernetes service accounts or AppRole, to get a token that Vault policies scope to certain paths. Vault Agent or the Vault Secrets Operator can render secrets into files or Kubernetes Secrets for apps that should not call Vault directly.

Rotation and Dynamic Secrets

Secrets Manager offers managed rotation for RDS, Aurora, Redshift and DocumentDB credentials, and a Lambda rotation function for anything else, on a schedule as frequent as every four hours. The rotated value is still a long-lived credential shared by every reader until the next rotation.

Vault's database, AWS and other secrets engines issue dynamic secrets instead: each client gets its own credential, created when requested, attached to a lease and revoked when the lease ends. Vault also runs a PKI engine for internal TLS certificates and a transit engine for encryption as a service, which Secrets Manager does not attempt.

Operations, Licensing and Cost

Secrets Manager is a managed service with no servers, priced at $0.40 per secret per month and $0.05 per 10,000 API calls, checked November 18, 2026. A typical backend with a few dozen secrets costs a few dollars a month.

Vault is a cluster you run with Raft integrated storage, usually three or five nodes, with unsealing through a cloud KMS, audit devices, backups and upgrades, or a managed HCP Vault Dedicated cluster. HashiCorp moved Vault to the Business Source License in 2023, and teams that need an open source license use OpenBao, the Linux Foundation fork.

Where Application Secrets Should Live

Both tools solve storage, and neither stops a developer from copying a key into a .env file that ends up in the repository, where every person and every AI coding agent with access can read it. The fix is to make code refer to secrets by name and keep values in the secrets system only, with local development reading them from the same place.

How Does Encore Handle Secrets?

Encore

Encore brings infrastructure from code to TypeScript and Go backends, and secrets are part of that: a service declares the secrets it needs as typed fields, values are set with the CLI per environment, and on deploy Encore replicates them into Secrets Manager on AWS or Secret Manager on GCP in your own account and injects them into the service, as the secrets docs describe. The value never lives in the repository.

Set up the app

Install the Encore CLI with the command for your system, then create the app:

Get started
brew install encoredev/tap/encore &&
encore app create
Copy

Run in your terminal to get started locally.

~
$ encore app create payments --example=hello-world$ cd payments && mkdir webhooks

A webhook receiver needs the provider's signing secret to check that a request is genuine:

// webhooks/webhooks.go package webhooks import ( "crypto/hmac" "crypto/sha256" "encoding/hex" "io" "net/http" "encore.dev/rlog" ) // Values are set with `encore secret set` and never stored in the repo. var secrets struct { WebhookSigningSecret string } //encore:api public raw method=POST path=/webhooks/payments func Receive(w http.ResponseWriter, req *http.Request) { body, err := io.ReadAll(io.LimitReader(req.Body, 1<<20)) if err != nil { http.Error(w, "bad body", http.StatusBadRequest) return } mac := hmac.New(sha256.New, []byte(secrets.WebhookSigningSecret)) mac.Write(body) expected := hex.EncodeToString(mac.Sum(nil)) if !hmac.Equal([]byte(expected), []byte(req.Header.Get("X-Signature"))) { http.Error(w, "invalid signature", http.StatusUnauthorized) return } rlog.Info("verified webhook", "bytes", len(body)) w.WriteHeader(http.StatusNoContent) }
~/payments
$ encore secret set --type dev,local WebhookSigningSecret$ encore secret set --type prod WebhookSigningSecret$ encore run

The secret is declared in code and its value is set per environment type, so local development, preview environments and production each get their own value, and encore run fetches the local one. The compiler refuses to deploy if a declared secret has no value for the target environment. A coding agent can write code that uses secrets.WebhookSigningSecret, and since the value is not in any file in the repository, the agent never sees it and cannot leak it into a commit or a prompt. In your AWS account the value sits in Secrets Manager, and Encore provisions an IAM role for the service.

Best fit: backend teams that want API keys and credentials kept out of the repository and delivered to each service in their own AWS or GCP account, with no secrets code to write.

AWS Secrets Manager by Hand

Without a framework, you create each secret in Secrets Manager, grant secretsmanager:GetSecretValue on its ARN to the task role, reference it from the ECS task definition or fetch it at startup, and configure rotation. Local development needs a separate path, often an AWS profile with read access or a .env file, which is where values tend to leak.

Best fit: AWS-only workloads that need managed storage and rotation for a known set of secrets.

HashiCorp Vault

Vault is the stronger choice when dynamic database credentials, short-lived cloud credentials, a private CA or encryption as a service are requirements, or when one secrets system must span AWS, GCP, Kubernetes and on-premises. It needs a team that will run it, or a budget for HCP.

Best fit: platform teams with multi-cloud or on-premises estates and a need for dynamic secrets and PKI.

How to Choose

Pick Secrets Manager when your workloads run on AWS and stored, rotated secrets are enough. Pick Vault when you need dynamic credentials, PKI or one system across environments, and can run it. Pick Encore when the goal is keeping application secrets out of the repository and delivering them to each service in your own cloud account, with Secrets Manager underneath on AWS.

Frequently asked questions

Should I use AWS Secrets Manager or HashiCorp Vault?

Use Secrets Manager when your workloads run on AWS and you need to store API keys and database credentials with IAM access control and rotation. Use Vault when you need dynamic, short-lived credentials across several clouds or on-premises systems, a private certificate authority, or encryption as a service, and you have a team to run it.

How much does AWS Secrets Manager cost?

AWS Secrets Manager charges $0.40 per secret per month and $0.05 per 10,000 API calls, according to its pricing page checked November 18, 2026. Vault Community Edition has no license fee, while a self-managed cluster costs the servers, storage and engineering time to run it, and HCP Vault Dedicated and Vault Enterprise are priced separately.

Is HashiCorp Vault still open source?

No. HashiCorp moved Vault from the MPL 2.0 license to the Business Source License in August 2023, and IBM completed its acquisition of HashiCorp in February 2025. OpenBao is a Linux Foundation fork of the last MPL-licensed Vault release for teams that need an open source license.

How do I keep API keys out of my repository when AI coding agents work in it?

Store secret values in a secrets service rather than in .env files committed to the repo, and have the code reference secrets by name. In Encore, a secret is a typed field declared in the code and set with encore secret set, so production values are never in the repository and an agent working in the repo can use the secret in code without reading those values. A local override in .secrets.local.cue is readable if it is present.

Deploy to your cloud on AWS and Google Cloud
without managing infrastructure

Encore lets developers and agents define application infrastructure directly in code, then automatically provisions it from local development to production in your AWS or GCP account.

~/orders — claude
Claude Code
Claude Code v2.1.180Opus 5.5~/orders