AWS Builder Center
The Ultimate Guide to Container Secrets Management on AWS: A Deep Dive into Parameter Store, Secrets Manager, and HashiCorp Vault

The Ultimate Guide to Container Secrets Management on AWS: A Deep Dive into Parameter Store, Secrets Manager, and HashiCorp Vault

I built a production-grade infrastructure comparing three secrets management approaches for containerized workloads on Amazon EKS. This article documents my journey, the architecture decisions, implementation challenges, and the insights I gained from deploying all three solutions side-by-side.

TL;DR: I built a production-grade infrastructure comparing three secrets management approaches for containerized workloads on Amazon EKS. This article documents my journey, the architecture decisions, implementation challenges, and the insights I gained from deploying all three solutions side-by-side.



🎯 Introduction: Why This Project Matters

In the world of cloud-native applications, secrets management is not optional—it's fundamental. Every containerized application needs credentials: database passwords, API keys, TLS certificates, and service tokens. How you manage these secrets can make the difference between a secure, auditable system and a ticking time bomb waiting to be exploited.
After years of working with various secrets management solutions, I decided to build a comprehensive, hands-on comparison of the three most popular approaches for AWS EKS workloads:
  1. AWS Systems Manager Parameter Store — The cost-effective, simple option
  1. AWS Secrets Manager — The managed solution with automatic rotation
  1. HashiCorp Vault — The enterprise-grade, multi-cloud powerhouse
This isn't just another theoretical comparison. I deployed real infrastructure, wrote production-quality Terraform code, and ran actual workloads to understand the nuances of each approach.



🔐 Solution 1: AWS Systems Manager Parameter Store

What is Parameter Store?

Parameter Store is AWS's hierarchical storage for configuration data and secrets. It's part of AWS Systems Manager and provides a centralized location to manage configuration data, whether plain-text data such as database strings or secrets such as passwords.

Why Choose Parameter Store?

Advantage
Description
Cost-Effective
Standard parameters are FREE (up to 10,000)
Simple Hierarchy
Organize parameters using paths: /prod/db/password
Native Integration
Works seamlessly with other AWS services
Versioning
Built-in parameter history and versioning

Implementation Deep Dive

Step 1: Create Parameters with Terraform

# terraform/modules/secrets/parameter_store.tf
resource "aws_ssm_parameter" "database_host" {
name = "/${var.project}/${var.environment}/database/host"
description = "Database hostname"
type = "SecureString"
value = var.database_host
key_id = aws_kms_key.secrets.arn

tags = {
Environment = var.environment
ManagedBy = "terraform"
}
}

resource "aws_ssm_parameter" "database_password" {
name = "/${var.project}/${var.environment}/database/password"
description = "Database master password"
type = "SecureString"
value = random_password.db_password.result
key_id = aws_kms_key.secrets.arn

tags = {
Environment = var.environment
ManagedBy = "terraform"
}
}


Step 2: Configure IRSA for Secure Access

# IAM policy for Parameter Store access
resource "aws_iam_policy" "parameter_store_read" {
name = "${var.project}-parameter-store-read"
description = "Allow reading from Parameter Store"

policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Effect = "Allow"
Action = [
"ssm:GetParameter",
"ssm:GetParameters",
"ssm:GetParametersByPath"
]
Resource = "arn:aws:ssm:${var.region}:${var.account_id}:parameter/${var.project}/*"
},
{
Effect = "Allow"
Action = [
"kms:Decrypt"
]
Resource = aws_kms_key.secrets.arn
}
]
})
}


Step 3: Deploy SecretProviderClass

# kubernetes/demo/03-secrets-store-csi.yaml
apiVersion: secrets-store.csi.x-k8s.io/v1
kind: SecretProviderClass
metadata:
name: aws-parameter-store
namespace: demo
spec:
provider: aws
parameters:
objects: |
- objectName: "/secrets-mgmt/dev/database/host"
objectType: "ssmparameter"
- objectName: "/secrets-mgmt/dev/database/password"
objectType: "ssmparameter"
secretObjects:
- secretName: db-credentials-from-param-store
type: Opaque
data:
- objectName: "/secrets-mgmt/dev/database/host"
key: DB_HOST
- objectName: "/secrets-mgmt/dev/database/password"
key: DB_PASSWORD


Step 4: Mount Secrets in Pod

apiVersion: apps/v1
kind: Deployment
metadata:
name: demo-csi-parameter-store
namespace: demo
spec:
replicas: 1
selector:
matchLabels:
app: demo-csi-parameter-store
template:
metadata:
labels:
app: demo-csi-parameter-store
spec:
serviceAccountName: demo-app-sa
containers:
- name: app
image: amazon/aws-cli:latest
command:
- /bin/sh
- -c
- |
echo "=== Secrets from Parameter Store (CSI Driver) ==="
echo "DB_HOST: $(cat /mnt/secrets/db-host)"
echo "DB_PASSWORD: [REDACTED]"
echo "✅ Successfully retrieved secrets from AWS Parameter Store!"
sleep infinity
volumeMounts:
- name: secrets-store
mountPath: "/mnt/secrets"
readOnly: true
volumes:
- name: secrets-store
csi:
driver: secrets-store.csi.k8s.io
readOnly: true
volumeAttributes:
secretProviderClass: "aws-parameter-store"


Verification





🔑 Solution 2: AWS Secrets Manager with External Secrets Operator

What is Secrets Manager?

AWS Secrets Manager is a fully managed service designed specifically for secrets. Unlike Parameter Store, it's purpose-built for secrets lifecycle management, including automatic rotation.

What is External Secrets Operator?

External Secrets Operator (ESO) is a Kubernetes operator that integrates external secret management systems with Kubernetes. It reads information from external APIs and automatically injects the values into Kubernetes Secrets.

Why This Combination?

Feature
Benefit
Automatic Rotation
Built-in Lambda functions for rotating RDS, Redshift, DocumentDB credentials
Native K8s Secrets
ESO creates standard Kubernetes Secrets that any pod can consume
Cross-Account Access
Secrets can be shared across AWS accounts
Audit Trail
Full CloudTrail integration for compliance
Sync Intervals
Automatic refresh of secrets in Kubernetes

Implementation Deep Dive

Step 1: Store Secrets in AWS Secrets Manager

# terraform/modules/secrets/secrets_manager.tf
resource "aws_secretsmanager_secret" "database_credentials" {
name = "${var.project}-${var.environment}/database/credentials"
description = "Database credentials for the application"
kms_key_id = aws_kms_key.secrets.arn

tags = {
Environment = var.environment
ManagedBy = "terraform"
}
}

resource "aws_secretsmanager_secret_version" "database_credentials" {
secret_id = aws_secretsmanager_secret.database_credentials.id
secret_string = jsonencode({
username = "dbadmin"
password = random_password.db_password.result
host = aws_db_instance.postgres.address
port = 5432
database = "appdb"
})
}


Step 2: Install External Secrets Operator



Step 3: Configure ClusterSecretStore

# kubernetes/demo/02-external-secrets.yaml
apiVersion: external-secrets.io/v1beta1
kind: ClusterSecretStore
metadata:
name: aws-secrets-manager
spec:
provider:
aws:
service: SecretsManager
region: us-east-1
auth:
jwt:
serviceAccountRef:
name: external-secrets
namespace: external-secrets


Step 4: Create ExternalSecret Resource

apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: database-credentials
namespace: demo
spec:
refreshInterval: 1h
secretStoreRef:
name: aws-secrets-manager
kind: ClusterSecretStore
target:
name: db-credentials
creationPolicy: Owner
data:
- secretKey: DB_USERNAME
remoteRef:
key: secrets-mgmt-dev/database/credentials
property: username
- secretKey: DB_PASSWORD
remoteRef:
key: secrets-mgmt-dev/database/credentials
property: password
- secretKey: DB_HOST
remoteRef:
key: secrets-mgmt-dev/database/credentials
property: host


Step 5: Deploy Application Using the Secret

apiVersion: apps/v1
kind: Deployment
metadata:
name: demo-external-secrets
namespace: demo
spec:
replicas: 1
selector:
matchLabels:
app: demo-external-secrets
template:
metadata:
labels:
app: demo-external-secrets
spec:
containers:
- name: app
image: amazon/aws-cli:latest
command:
- /bin/sh
- -c
- |
echo "=== Secrets from AWS Secrets Manager (via ESO) ==="
echo "DB_HOST: $DB_HOST"
echo "DB_USERNAME: $DB_USERNAME"
echo "DB_PASSWORD: [REDACTED]"
echo "✅ Successfully synced secrets via External Secrets Operator!"
sleep infinity
envFrom:
- secretRef:
name: db-credentials


Verification






🏰 Solution 3: HashiCorp Vault with CSI Provider

What is HashiCorp Vault?

Vault is a secrets management tool by HashiCorp that provides a unified interface to any secret while providing tight access control and recording a detailed audit log. It's the Swiss Army knife of secrets management.

Why Choose Vault?

Feature
Description
Dynamic Secrets
Generate on-demand, short-lived credentials for databases, cloud providers, etc.
Multi-Cloud
Works with AWS, GCP, Azure, and on-premises
Encryption as a Service
Transit secrets engine for application-level encryption
PKI
Full certificate authority capabilities
Identity-Based Access
Kubernetes, LDAP, OIDC authentication

Implementation Deep Dive

Step 1: Deploy Vault on EKS

# kubernetes/helm-values/vault.yaml
server:
ha:
enabled: false
standalone:
enabled: true
config: |
ui = true
listener "tcp" {
tls_disable = 1
address = "[::]:8200"
cluster_address = "[::]:8201"
}
storage "file" {
path = "/vault/data"
}
serviceAccount:
annotations:
eks.amazonaws.com/role-arn: "arn:aws:iam::ACCOUNT:role/vault-role"

csi:
enabled: true

injector:
enabled: true


Step 2: Initialize and Unseal Vault


Output:
Key Value
--- -----
Seal Type shamir
Initialized true
Sealed false
Total Shares 1
Threshold 1
Version 1.21.2
Storage Type file
Cluster Name vault-cluster-xxxxx
HA Enabled false


Step 3: Configure Kubernetes Authentication

# Enable Kubernetes auth method
kubectl exec -n vault vault-0 -- vault auth enable kubernetes

# Configure the Kubernetes auth method
kubectl exec -n vault vault-0 -- vault write auth/kubernetes/config \
kubernetes_host="https://$KUBERNETES_PORT_443_TCP_ADDR:443"


Step 4: Create Secrets and Policies

# Enable KV secrets engine
kubectl exec -n vault vault-0 -- vault secrets enable -path=secret kv-v2

# Store database credentials
kubectl exec -n vault vault-0 -- vault kv put secret/database \
username="vault_user" \
password="vault_secure_password_123" \
host="secrets-mgmt-dev-postgres.cj8kqco46f82.us-east-1.rds.amazonaws.com"

# Create policy for the demo app
kubectl exec -n vault vault-0 -- vault policy write demo-app - <<EOF
path "secret/data/database" {
capabilities = ["read"]
}
EOF

# Create Kubernetes auth role
kubectl exec -n vault vault-0 -- vault write auth/kubernetes/role/demo-app \
bound_service_account_names=demo-app-sa \
bound_service_account_namespaces=demo \
policies=demo-app \
ttl=24h


Step 5: Deploy SecretProviderClass for Vault

apiVersion: secrets-store.csi.x-k8s.io/v1
kind: SecretProviderClass
metadata:
name: vault-database
namespace: demo
spec:
provider: vault
parameters:
vaultAddress: "http://vault.vault.svc.cluster.local:8200"
roleName: "demo-app"
objects: |
- objectName: "db-username"
secretPath: "secret/data/database"
secretKey: "username"
- objectName: "db-password"
secretPath: "secret/data/database"
secretKey: "password"
- objectName: "db-host"
secretPath: "secret/data/database"
secretKey: "host"


Step 6: Deploy Application with Vault Secrets

apiVersion: apps/v1
kind: Deployment
metadata:
name: demo-vault-csi
namespace: demo
spec:
replicas: 1
selector:
matchLabels:
app: demo-vault-csi
template:
metadata:
labels:
app: demo-vault-csi
spec:
serviceAccountName: demo-app-sa
containers:
- name: app
image: amazon/aws-cli:latest
command:
- /bin/sh
- -c
- |
echo "=== Secrets from HashiCorp Vault (CSI Driver) ==="
echo "DB_HOST: $(cat /mnt/secrets/db-host)"
echo "DB_USERNAME: $(cat /mnt/secrets/db-username)"
echo "DB_PASSWORD: [REDACTED]"
echo "✅ Successfully retrieved secrets from HashiCorp Vault!"
sleep infinity
volumeMounts:
- name: secrets-store
mountPath: "/mnt/secrets"
readOnly: true
volumes:
- name: secrets-store
csi:
driver: secrets-store.csi.k8s.io
readOnly: true
volumeAttributes:
secretProviderClass: "vault-database"


Verification





📊 Comprehensive Comparison

After implementing and running all three solutions, here's my detailed comparison:

Feature Matrix

Feature
Parameter Store
Secrets Manager
HashiCorp Vault
Pricing
Free (standard)
$0.40/secret/month
Self-hosted (free) or Enterprise
Max Secret Size
8 KB (advanced: 8 KB)
64 KB
Unlimited
Automatic Rotation
❌ Manual only
✅ Native Lambda integration
✅ Dynamic secrets
Versioning
✅ Built-in
✅ Built-in
✅ Built-in
Encryption
✅ KMS
✅ KMS
✅ Transit engine
Audit Logging
CloudTrail
CloudTrail
Built-in audit device
Multi-Cloud
❌ AWS only
❌ AWS only
✅ Full support
Dynamic Secrets
❌
❌
✅ Databases, AWS, etc.
Kubernetes Integration
CSI Driver
ESO or CSI
Agent, CSI, or ESO
Learning Curve
Low
Low
Medium-High
High Availability
✅ Managed
✅ Managed
Self-managed
Cross-Account
✅ Resource policies
✅ Resource policies
✅ Namespaces

Performance Comparison

Metric
Parameter Store
Secrets Manager
Vault
Secret Retrieval Latency
~50-100ms
~50-100ms
~10-50ms (in-cluster)
Throughput (requests/sec)
40-100 (standard)
10,000+
Unlimited (self-hosted)
Cold Start
N/A
N/A
2-5s (CSI mount)

Cost Analysis (Monthly, 100 Secrets)

Solution
Secrets Cost
API Calls (100k)
Total
Parameter Store
$0
$0.05
$0.05
Secrets Manager
$40
$0.05
$40.05
Vault (Self-Hosted)
$0
$0
EC2 cost only



🎓 Lessons Learned

1. IRSA is Non-Negotiable

Every solution I implemented relied on IAM Roles for Service Accounts. Without IRSA:
  • Pods would need static AWS credentials (anti-pattern)
  • No fine-grained, pod-level access control
  • Credential rotation becomes a nightmare
Key insight: Always set up IRSA before implementing any secrets solution.

2. The CSI Driver is Incredibly Versatile

The Secrets Store CSI Driver works with ALL three solutions:
  • AWS Parameter Store (via AWS provider)
  • AWS Secrets Manager (via AWS provider)
  • HashiCorp Vault (via Vault provider)
This means you can mix and match or migrate between solutions without changing your pod specifications.

3. External Secrets Operator Provides the Best Developer Experience

ESO converts external secrets into native Kubernetes Secrets. This means:
  • Developers use familiar  envFrom  and  secretRef  patterns
  • No special volume mounts required
  • Works with any existing tooling that understands K8s Secrets

4. Vault Requires Operational Investment

Vault is powerful but requires:
  • Initialization and unsealing (automated or manual)
  • Policy management
  • Regular maintenance and upgrades
  • Backup and disaster recovery planning
For teams without dedicated platform engineers, this overhead may not be justified.

5. EKS VPC Configuration Matters

I encountered issues with Vault Agent Injector because the EKS control plane couldn't reach the webhook. Solutions:
  • Use VPC endpoints for the EKS control plane
  • Ensure security groups allow the control plane to reach the webhook
  • Consider CSI provider as an alternative to the injector



🏆 Recommendations

Choose Parameter Store When:

  • ✅ You're cost-conscious and have < 10,000 parameters
  • ✅ Your secrets don't need automatic rotation
  • ✅ You want the simplest possible setup
  • ✅ You're already deep in the AWS ecosystem

Choose Secrets Manager When:

  • ✅ You need automatic credential rotation
  • ✅ You're using RDS, Redshift, or DocumentDB
  • ✅ You need cross-account secret sharing
  • ✅ Compliance requires detailed audit trails

Choose HashiCorp Vault When:

  • ✅ You're multi-cloud or hybrid
  • ✅ You need dynamic, short-lived credentials
  • ✅ You require advanced features like PKI or encryption as a service
  • ✅ You have dedicated platform engineering resources



🚀 What's Next?

This project has opened several avenues for exploration:
  1. Dynamic Database Credentials with Vault — Generate PostgreSQL credentials on-demand with automatic expiration
  1. Secrets Rotation Automation — Implement Lambda functions for Secrets Manager rotation
  1. GitOps Integration — Manage ExternalSecrets with ArgoCD or Flux
  1. Multi-Cluster Secrets — Sync secrets across multiple EKS clusters



📚 Resources




🙏 Acknowledgments

This project was built with countless cups of coffee, late-night debugging sessions, and the incredible open-source community. Special thanks to:
  • The External Secrets Operator maintainers
  • HashiCorp for Vault and Terraform
  • The Kubernetes SIG-Auth team for the Secrets Store CSI Driver
  • AWS for EKS and the secrets services


Did you find this article helpful? Give it a 👏 and share it with your network. Have questions or feedback? Drop a comment below!
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article