Vault's AWS authentication offers two modes — IAM and EC2 — but for containers and serverless workloads, IAM mode is the better operational fit.
The essence of IAM authentication is that Vault verifies the client's AWS identity by validating a signed sts:GetCallerIdentity request.
In IAM mode, the client submits an sts:GetCallerIdentity request signed with AWS Signature Version 4 to Vault, which forwards it to AWS STS for verification. Vault has the client's IAM role or user ARN pre-bound to its role configuration; if it matches, Vault issues a token.
For replay resistance, Vault recommends the X-Vault-AWS-IAM-Server-ID header (header_value). Setting the same value on both the server and the client signature blocks man-in-the-middle attacks and cross-region replay.
Trust chain for an IAM login
Vault's AWS authentication has two modes — IAM and EC2 — and AppRole is the typical choice for non-AWS workloads. The exam frequently tests the boundary conditions: which method fits which environment.
IAM fits instance-independent principals like ECS task roles and Lambda execution roles. EC2 mode's strength is binding via the instance identity document. AppRole works entirely outside AWS but requires separate rotation operations.
| Auth Method | Primary Bind Condition | Typical Use Case | Strengths |
|---|---|---|---|
| AWS IAM | bound_iam_principal_arn (IAM role / user ARN) | Execution roles for ECS, EKS, Lambda, or external IDs | Instance-independent, no key distribution, easy least-privilege |
| AWS EC2 | AMI, instance tag, region, role, and more | Workloads tightly coupled to fixed EC2 instances | Strict binding via detailed instance attributes |
| AppRole | RoleID + SecretID | On-prem, other clouds, CI, anywhere outside AWS | No AWS dependency, simple model |
In IAM mode, the server generally does not need AWS credentials configured. Enable AWS auth, set the Server-ID, then create an auth role bound to an IAM role (or user).
The role defines policies, TTL, whether re-authentication is allowed, and so on. bound_iam_principal_arn accepts multiple values, so it handles cross-account scenarios.
Vault server configuration example (IAM mode)
# AWS auth を有効化(パスは必要に応じて変更)
vault auth enable -path=aws aws
# Server-ID ヘッダ値を設定(クライアントが署名時に同値を入れる)
vault write auth/aws/config/client \
iam_server_id_header_value="vault.example.com"
# アプリ用ポリシー(例)
vault policy write app - <<'EOF'
path "secret/data/app/*" {
capabilities = ["read"]
}
EOF
# IAM ロールにバインドした認証ロールを作成
vault write auth/aws/role/app \
auth_type=iam \
bound_iam_principal_arn=arn:aws:iam::111111111111:role/app-task \
policies=app \
max_ttl=1h \
disallow_reauthentication=trueThe client uses its own AWS execution role to generate a signed sts:GetCallerIdentity request. The Vault CLI and Vault Agent automate both the signing and the submission to /auth/aws/login.
The key points are sourcing credentials from AWS environment variables (or the instance/task role) and matching the Server-ID header value.
CLI and Vault Agent examples
# CLI 例(AWS_PROFILE / タスクロールなどで認証情報が利用可能であること)
export AWS_REGION=ap-northeast-1
vault login -method=aws role=app header_value=vault.example.com
# 成功すると Vault トークンが返る(-format=json で機械可読)
# vault login -method=aws role=app header_value=vault.example.com -format=json | jq
# Vault Agent 例(/etc/vault.d/agent-iam.hcl)
auto_auth {
method "aws" {
mount_path = "auth/aws"
config = {
type = "iam"
role = "app"
header_value = "vault.example.com"
# 必要に応じて region 等を指定
}
}
sink "file" {
config = {
path = "/tmp/vault-token"
}
}
}
cache {
use_auto_auth_token = true
}
vault {
address = "https://vault.example.com"
}IAM auth can bind roles in other AWS accounts. Just list the target role ARNs in bound_iam_principal_arn and applications across accounts can log in. Even when the caller presents an assumed-role session ARN, Vault normalizes it to the underlying role ARN before matching.
Because any principal can call sts:GetCallerIdentity, you don't need to grant special IAM permissions for IAM auth to work. The real-world success factors are network reachability from Vault to AWS STS, clock synchronization, and Server-ID consistency.
Example: binding to multiple principals
# 複数の IAM ロールを同一 Vault ロールへバインド
vault write auth/aws/role/app \
auth_type=iam \
bound_iam_principal_arn=arn:aws:iam::111111111111:role/app-task,arn:aws:iam::222222222222:role/app-task \
policies=app \
max_ttl=1hIn production, the typical failures are Server-ID mismatch, clock skew, and ARN type mistakes (such as registering a user ARN as a role). On the exam, expect questions on choosing between IAM and EC2, on bound_iam_principal_arn and header_value semantics, and on the fact that Vault verifies logins without holding AWS credentials.
When isolating issues, work through them in order: inspect responses with -format=json, check the audit log, and verify reachability to AWS STS (proxies, firewalls).
Verification command snippets
# 応答の確認
vault login -method=aws role=app header_value=vault.example.com -format=json | jq '.auth.lease_duration,.auth.policies'
# 監査ログ(ファイル監査デバイス例)
vault audit enable file file_path=/var/log/vault_audit.log
tail -f /var/log/vault_audit.log | grep "/auth/aws/login"Associate
問題 1
In Vault AWS authentication (IAM mode), which parameter binds the client's execution role to the role configuration?
正解: A
In IAM mode, the client's IAM role/user ARN is set on bound_iam_principal_arn for matching. iam_server_id_header_value is the anti-replay header value, and credential_type is a Secrets Engine concept that doesn't apply to auth roles.
Does Vault need AWS credentials to verify logins in IAM mode?
No. Vault simply forwards the client-signed sts:GetCallerIdentity call to STS and matches the returned Caller ARN against the role configuration. All Vault needs is network reachability to STS.
Is the Server-ID header (X-Vault-AWS-IAM-Server-ID) required?
Strongly recommended. Matching Vault's iam_server_id_header_value with the header_value the client includes in its signature prevents replay attacks and misrouted requests. The purpose of this header is a common exam topic.
Can clients log in from IAM roles in a different AWS account?
Yes. Just list the target role ARNs in bound_iam_principal_arn. Assumed-role session ARNs are normalized to the underlying role ARN before matching.
Practice with certification-focused question sets
無料で問題を解いてみるNicheeLab Editorial Team
NicheeLab editorial team focused on data engineering and cloud certification learning. Content is structured around practical study needs and official exam domains.
Vault Core Concepts: Sealed/Unsealed, Auth, Secrets (2026)
Vault fundamentals — sealed/unsealed state, auth methods, se...
Vault Operations Professional (VOP-003): Complete Guide (2026)
Pass the Vault Operations Professional exam — enterprise pat...
Vault Path-Based Routing: API URL Structure (2026)
How Vault's path-based routing works — mount points, sub-pat...
Vault Tokens: Auth Token Mechanics (2026)
Token fundamentals — service vs. batch tokens, accessor, ren...
Vault Token Types: Service, Batch, Periodic (2026)
Service vs. batch tokens compared — performance, ACL behavio...