CloudHSM Cluster Posture Auditor
Mindset
One-line takeaway: the verdict is always the worst finding across
all dimensions, ordered SINGLE_AZ > NO_BACKUP > CONFIG_GAP > OK. The most
common — and most dangerous — misjudgment is treating HSM count as a proxy
for high availability: three HSMs in a single AZ provide HSM-level
redundancy but zero AZ-level redundancy.
AWS CloudHSM provides single-tenant FIPS 140-2 Level 3 HSM instances. A
cluster is the management boundary — it groups HSMs, backups, and the
certificate trust chain. Three properties make CloudHSM uniquely fragile
compared to other AWS services:
- HSMs are stateful and single-tenant. Unlike EC2 or RDS, you cannot
"just restart" an HSM. If an HSM fails, its key material survives only
in backups and in the other HSMs that were synchronised before the failure.
- Backups are the ONLY recovery path. CloudHSM has no snapshots, no
automated cross-region replication, and no recycle bin. A cluster with no
backups that loses all HSMs is permanently unrecoverable — every key is
lost forever.
- Cluster initialization is a trust anchor. The signed certificate
uploaded during InitializeCluster is how clients verify the HSM's
identity. An uninitialized cluster is physically present but
cryptographically unreachable — clients will refuse to connect.
Quick reference — verdict thresholds
| Condition |
Verdict |
Step |
| All HSMs in a single AZ (regardless of HSM count) |
SINGLE_AZ |
Step 1 |
| Fewer than 2 distinct AZs represented across ACTIVE HSMs |
SINGLE_AZ |
Step 1 |
| BackupRetentionPolicy Type=DAYS Value=0 (or absent) |
NO_BACKUP |
Step 2 |
| Zero backups exist |
NO_BACKUP |
Step 2 |
| Most recent backup >7 days old |
NO_BACKUP |
Step 2 |
| Cluster State=UNINITIALIZED (no signed certificate) |
CONFIG_GAP |
Step 3 |
| Default CO password unchanged |
CONFIG_GAP |
Step 3 |
| Security group allows 0.0.0.0/0 on ports 2223-2225 |
CONFIG_GAP |
Step 3 |
| 2+ HSMs across 2+ AZs, recent backups, clean config |
OK |
Step 4 |
Verdict precedence: SINGLE_AZ > NO_BACKUP > CONFIG_GAP > OK (worst finding
wins).
Pre-flight: cluster metadata gate
Before evaluating the cluster posture, classify the cluster itself.
Multi-cluster / account-wide sweep note: aws cloudhsm describe-clusters
returns all clusters in the region (no pagination needed for the cluster
list itself). For each cluster, call aws cloudhsm describe-backups --cluster-id <id> — backups are paginated at 50 per page, so use
--next-token to drain the full list.
| Attribute |
Value |
Effect on audit |
State |
UNINITIALIZED |
Cluster not initialized. Jump to Step 3 — this is always at least CONFIG_GAP. Clients cannot connect. |
State |
INITIALIZED |
Proceed with full audit. |
State |
CREATE_IN_PROGRESS |
Output: VERDICT: ERROR, REASON: Cluster creation in progress — re-audit when State is UNINITIALIZED or INITIALIZED. |
State |
DELETE_IN_PROGRESS |
Output: VERDICT: ERROR, REASON: Cluster is being deleted — no posture audit applicable. |
State |
DEGRADED |
One or more HSMs are degraded. Still audit all dimensions; add a DEGRADED note. |
HsmType |
hsm1m.medium / hsm2m.medium |
Note the type — it is immutable after cluster creation. Flag older types as a migration-planning note, not a security verdict. |
HSM State |
Any non-ACTIVE |
Exclude from effective cross-AZ count. If this drops the AZ count below 2, escalate to SINGLE_AZ. |
If the cluster configuration is malformed (missing HSM list, missing
SubnetMapping, invalid State), output:
CLUSTER: <cluster-id>
VERDICT: ERROR
REASON: Cluster configuration is incomplete or malformed — cannot classify.
REMEDIATION: Retrieve the canonical config with `aws cloudhsm describe-clusters --cluster-id <id> --output json` and re-audit.
Process — Classification logic (apply in order, aggregate worst)
Step 0: Expert knowledge — non-obvious CloudHSM behaviors that change classification
→ All 15 non-obvious behaviors (HSM count ≠ HA, retention DAYS=0, UNINITIALIZED unreachability, default CO password, KMS custom key store coupling, ports 2223-2225, point-in-time backups, DeleteCluster gate, immutable HSM type, quorum, full CA chain, restore = new cluster ID, CREATE_IN_PROGRESS gap, DAYS vs COUNT, immutable security group) — references/advanced-patterns.md.
Step 1: Cluster HA / AZ distribution (highest priority — SINGLE_AZ)
For each ACTIVE HSM in the cluster, extract AvailabilityZone. Classify:
SINGLE_AZ — All ACTIVE HSMs reside in the same AZ, OR fewer than 2
distinct AZs are represented. This is the worst verdict because an
AZ-level event (power, network, cooling) takes down the entire cluster
simultaneously.
OK for HA — ACTIVE HSMs span 2+ distinct AZs. The minimum for HA is
2 HSMs in 2 distinct AZs. AWS recommends 3 HSMs in 3 AZs for production
(provides quorum-based recovery and tolerates a full-AZ failure with no
data loss).
HSM state interaction: exclude any HSM in a non-ACTIVE state
(DEGRADED, CREATE_IN_PROGRESS) from the effective AZ count before
evaluating this step. A cluster with 3 HSMs across 3 AZs where one HSM is
DEGRADED has an effective count of 2 AZs — still HA, but the degraded HSM
should be noted as an operational risk.
Single-HSM special case: a cluster with exactly 1 HSM is ALWAYS
SINGLE_AZ, regardless of the AZ or subnet configuration. A single HSM is
a single point of failure for both HSM-level and AZ-level redundancy.
Step 2: Backup posture (NO_BACKUP)
Evaluate backup readiness across three sub-dimensions. ANY failure
produces NO_BACKUP:
Retention policy: If BackupRetentionPolicy.Type is DAYS and
Value is "0", OR the policy is absent entirely, backups are
effectively disabled. Even if some backups exist from before the policy
change, they are orphans with no retention guarantee and will be
auto-deleted.
Backup count: If zero backups exist in the cluster's backup list
(from aws cloudhsm describe-backups --cluster-id <id>), there is no
recovery path. All key material, users, and policies are irrecoverable
if the cluster fails.
Backup recency: If the most recent backup (by CreateDate) is more
than 7 days old, the backup posture is effectively stale. CloudHSM
creates backups automatically on a periodic schedule, and a gap >7 days
indicates the backup mechanism is broken or the retention policy is
aggressively deleting backups before new ones complete.
Expert note — retention calibration: the default retention is 90 days
(Type=DAYS, Value=90). This is adequate for operational recovery but may
be insufficient for compliance frameworks requiring 1-year or 7-year
retention. When auditing for compliance, compare the retention period
against the framework's requirement and flag as CONFIG_GAP if shorter.
Step 3: Configuration posture (CONFIG_GAP)
Evaluate cluster configuration across four sub-dimensions. Each failure
produces a CONFIG_GAP finding:
3a. Cluster initialization:
If State is UNINITIALIZED, the cluster has not been initialized.
Clients cannot connect. The InitializeCluster step (download CSR, sign
with CA, upload signed cert plus trust chain) has not been completed.
This is always CONFIG_GAP.
3b. PKCS#11 user management — default CO password:
If the default Crypto Officer password has not been changed (the operator
confirms co_password_changed: false, or the password change timestamp
matches/predates the cluster initialization date), the cluster is using a
well-known credential. This is CONFIG_GAP. There is no AWS API to verify
password state — rely on operator-provided metadata.
3c. Security group exposure:
If the cluster's security group allows inbound from 0.0.0.0/0 on any
CloudHSM port (2223-2225), the HSM management and data interfaces are
exposed to any network-reachable entity. This is CONFIG_GAP. The correct
posture is to allow inbound only from the application subnet CIDR or a
specific client security group.
3d. Quorum / M-of-N authentication (regulated environments):
If quorum is not enabled for sensitive CO operations (user deletion, key
deletion, policy modification) in a regulated environment, flag as
CONFIG_GAP. Quorum is configured client-side via cloudhsm_mgmt_util.
Step 4: Aggregation — worst finding wins
The final verdict is the maximum severity across all dimensions, where
SINGLE_AZ > NO_BACKUP > CONFIG_GAP > OK:
verdict = max(ha_finding, backup_finding, config_finding)
If no findings (all dimensions pass), the verdict is OK.
Output format (per cluster)
CLUSTER: <cluster-id>
VERDICT: SINGLE_AZ | NO_BACKUP | CONFIG_GAP | OK
REASON: <1-2 sentences citing the worst finding and its step>
FINDINGS:
- [SINGLE_AZ] <finding description (Step 1)>
- [NO_BACKUP] <finding description (Step 2)>
- [OK] <dimension that passed>
REMEDIATION: <specific action per finding, or "None required" if OK>
Worked example — single-AZ cluster with no backup
CLUSTER: cluster-single-az-demo
VERDICT: SINGLE_AZ
REASON: All 1 HSMs reside in a single AZ (us-east-1a) — an AZ-level event
takes the entire cluster offline with no cross-AZ failover. Backup retention
is also disabled (Type=DAYS, Value=0), compounding the risk with no recovery
path.
FINDINGS:
- [SINGLE_AZ] 1 HSM in us-east-1a only — no AZ-level redundancy (Step 1)
- [NO_BACKUP] BackupRetentionPolicy DAYS=0 — backups disabled (Step 2)
REMEDIATION:
1. Add HSMs in at least one additional AZ: aws cloudhsm create-hsm
--cluster-id <id> --availability-zone us-east-1b --subnet-id <subnet-b>.
2. Set backup retention: modify-backup-attributes with Type=DAYS,Value=90.
3. Create an immediate backup: aws cloudhsm create-backup --cluster-id <id>.
Edge-case handling
→ All five edge cases (DEGRADED HSMs, KMS Custom Key Store coupling, 2-AZ minimum, recently created cluster with no backups, backup in CREATE_IN_PROGRESS) — references/advanced-patterns.md.
Anti-Patterns — NEVER
NEVER treat HSM count as sufficient for HA. Three HSMs in a single AZ
is SINGLE_AZ — the AZ is the failure domain, not the individual HSM. A
single power or network event in that AZ destroys all three HSMs
simultaneously. Always check AZ distribution.
NEVER classify a cluster with zero backups as OK. Without a backup,
total cluster failure means permanent, unrecoverable key-material loss.
CloudHSM has no snapshot, no recycle bin, and no automated cross-region
replication. The backup is the ONLY recovery path.
NEVER assume BackupRetentionPolicy Type=DAYS Value=0 means "keep
forever." It means the opposite — backups are immediately eligible for
deletion. This is one of the most dangerous CloudHSM misconfigurations
because it looks like a valid retention policy.
NEVER treat an UNINITIALIZED cluster as production-ready. The HSMs may
report ACTIVE state, but without the signed certificate from
InitializeCluster, clients cannot establish the NTLS trust link. The
cluster is cryptographically unreachable.
NEVER leave the default CO password in place for production. It is a
documented credential — any principal with VPC network access to port
2224 can authenticate as Crypto Officer and manage all keys. The
password change is the first post-initialization action.
NEVER expose CloudHSM ports 2223-2225 to 0.0.0.0/0. These ports carry
PKCS#11 data-plane traffic (2223), NTLS management (2224), and
monitoring (2225). An open security group lets any network-reachable
client attempt HSM authentication — the default CO password combined
with an open SG is a full compromise path.
NEVER ignore backup recency. A backup from 30 days ago is marginally
better than no backup, but any keys created or rotated since then are
unrecoverable. The 7-day threshold is the practical maximum for
production; beyond that, the backup is dangerously stale.
NEVER assume a cluster in DEGRADED state has the same HA posture as
one with all ACTIVE HSMs. A DEGRADED HSM may not be synchronizing key
material — exclude it from the effective AZ count when evaluating Step 1.
NEVER recommend deleting a cluster without verifying it is not linked
as a KMS Custom Key Store. Deleting a backing cluster causes all KMS
operations on that custom key store to fail permanently. Always check
aws kms describe-custom-key-stores before recommending deletion.
NEVER recommend changing the HSM type (hsm1m.medium to hsm2m.medium) as
an in-place remediation. The type is immutable — the only path is
create-new-cluster, restore-from-backup, migrate-clients, which is a
multi-hour maintenance window.
NEVER assume BackupRetentionPolicy Type=DAYS guarantees a minimum number
of restorable backups. DAYS deletes by age, not by count — if the backup
schedule is disrupted, the cluster can reach zero valid backups within
the retention window. Use Type=COUNT to guarantee N restorable points
regardless of schedule gaps, or monitor backup creation alerts to catch
schedule disruptions early.
Pre-flight safety checks (run before any remediation CLI)
MANDATORY CONFIRMATION GATE. Before any state-changing operation
(CreateHsm, DeleteHsm, DeleteCluster, InitializeCluster,
ModifyBackupAttributes, CreateBackup, DeleteBackup), the auditor MUST
emit: CONFIRM: About to <action> on cluster <id>. This affects <consequence>. Proceed? (yes/no). Do NOT execute until the operator
confirms.
Confirm the cluster exists and is accessible:
aws cloudhsm describe-clusters --cluster-id <id> --profile <p> —
fail closed (skip remediation) if it returns an error.
Before modifying backup retention, snapshot the current backup list:
aws cloudhsm describe-backups --cluster-id <id> --output json > /tmp/<id>-backups-$(date +%s).json. This documents what was restorable
before the change.
Before adding an HSM to a cluster, verify the target subnet exists and
has available ENI capacity — each HSM consumes one ENI in its subnet.
Before initializing a cluster, verify the signed certificate includes
the FULL CA chain (leaf, intermediate, root). A partial chain causes
cryptic client connection failures.
For SINGLE_AZ findings on a KMS Custom Key Store cluster, treat as
incident-response — add cross-AZ HSMs immediately. KMS operations are
silently failing during AZ events.
Prefer additive changes (add HSMs, add backups) over destructive changes
(delete HSMs, delete backups). Additive changes do not risk existing key
material or recovery points.
Remediation guidance
For SINGLE_AZ
- Add HSMs in additional AZs to achieve cross-AZ distribution:
aws cloudhsm create-hsm --cluster-id <id> --availability-zone <az> --subnet-id <subnet-id>.
- Target 3 HSMs across 3 AZs for production — provides quorum-based
recovery and tolerates a full-AZ failure with no data loss.
- If the cluster is a KMS Custom Key Store, this is elevated operational
risk — KMS Encrypt/Decrypt calls will fail during AZ events with
KMSInternalException.
- After adding HSMs, verify they reach ACTIVE state and synchronise keys
from existing HSMs before considering HA achieved.
For NO_BACKUP
- Set a proper backup retention policy using
aws cloudhsm modify-backup-attributes with Type=DAYS, Value=90.
- Create an immediate on-demand backup:
aws cloudhsm create-backup --cluster-id <id>.
- If the most recent backup is stale (>7 days), investigate why scheduled
backups are not being created. Common cause: retention Value=0 auto-
deleting backups faster than they are created.
- For compliance frameworks requiring longer retention, increase Value
accordingly (e.g., 365 for annual retention).
For CONFIG_GAP — uninitialized cluster
- Download the cluster CSR from
describe-clusters output
(Certificates.ClusterCsr).
- Sign the CSR with your issuing CA (or self-sign for testing):
openssl x509 -req -in cluster.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out signed.crt -days 365.
- Upload the signed certificate and trust anchor:
aws cloudhsm initialize-cluster --cluster-id <id> --signed-cert fileb://signed.crt --trust-anchor fileb://ca.crt.
- After initialization, immediately change the default CO password via
cloudhsm_mgmt_util.
For CONFIG_GAP — default CO password unchanged
- Connect to the HSM using cloudhsm_mgmt_util with the cluster config.
- Log in with the default CO credentials.
- Change the password using
changePswd CO admin <new-password>.
- Verify by logging out and back in with the new password.
For CONFIG_GAP — open security group
- Identify the security group(s) attached to the cluster's HSM ENIs.
- Remove the 0.0.0.0/0 inbound rule on ports 2223-2225.
- Add a scoped inbound rule allowing only the application subnet CIDR or
client security group on ports 2223-2225.
- Verify client connectivity from the application tier.
For OK
- No remediation required for the current posture.
- Recommend enabling quorum authentication for regulated environments.
- Recommend 3 HSMs across 3 AZs if currently at the 2-AZ minimum.
- Verify backup restore readiness by periodically performing a test
restore to a staging cluster.
AWS documentation
Recent AWS features (2024-2026)
→ All five updates (hsm2m.medium GA, cross-region backup copy, enhanced CloudTrail logging, DAYS+COUNT retention, security-group referencing) — references/advanced-patterns.md.
References (load on demand)
references/advanced-patterns.md — Step 0 expert knowledge (15 non-obvious CloudHSM behaviors), edge-case handling catalog, recent AWS features (2024-2026)
Domain
AWS CloudOps / CloudHSM Security & Compliance.
1---2name: cloudhsm-cluster-posture-auditor3description: Audits AWS CloudHSM clusters for high-availability posture (HSM count and cross-AZ distribution), backup/restore readiness (retention policy, backup recency, restorability), PKCS#11 user management (default CO password, quorum), cluster initialization (certificate signing chain), and subnet/ security-group network exposure. Emits a deterministic verdict (SINGLE_AZ | NO_BACKUP | CONFIG_GAP | OK) per cluster with enumerated findings and specific remediation. Use when reviewing CloudHSM cluster configuration, checking HA readiness, validating backup posture, auditing PKCS#11 user hygiene, or hardening HSM security before production deployment.4license: Apache-2.05compatibility: Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). No AWS CLI required for offline cluster-config classification. Live-account audits use aws cloudhsm describe-clusters, aws cloudhsm describe-backups, and cloudhsm_mgmt_util (AWS CLI v2, SSO or key-based credentials).6metadata:7 source: https://skillmd.com/skills/jhkchan/cloudhsm-cluster-posture-auditor8 domain: aws-cloudops9 complexity: high10 requires_llm: 'true'11 phase: '2'12 supports_pipeline: 'true'13 entry_point: 'false'14 family: Security15 verdict_shape: SINGLE_AZ | NO_BACKUP | CONFIG_GAP | OK16 when_to_use: Reviewing a CloudHSM cluster before production deployment, checking HA readiness across availability zones, validating backup posture and retention, auditing PKCS#11 user management, inspecting cluster initialization state, or hardening HSM network exposure.17 activation_triggers: audit this CloudHSM cluster, check CloudHSM HA posture, is my CloudHSM cluster highly available, CloudHSM backup readiness, CloudHSM PKCS#11 user audit, CloudHSM single AZ risk, CloudHSM cluster initialized, harden CloudHSM cluster18 invocation_schema: 'Input: either (a) a CloudHSM cluster configuration (describe-clusters output plus PKCS#11 management metadata), optionally paired with backup details, OR (b) a cluster-id for live-account audit. Output: deterministic CLUSTER/VERDICT/REASON/FINDINGS/REMEDIATION block per cluster, where VERDICT is one of SINGLE_AZ, NO_BACKUP, CONFIG_GAP, OK, or ERROR.'19 version: 0.1.020 author: Jacky Chan — AWS Community Builder21 keywords: CloudHSM, cluster posture, high availability, HSM, PKCS#11, backup, cross-AZ, single-AZ, certificate signing, InitializeCluster, Crypto Officer, CO password, quorum, subnet routing, security group, FIPS 140-2, key management, hardware security module, backup retention, cluster initialization22 tags: cloudhsm, security, ha, backup, pkcs11, hsm, fips, audit23---2425# CloudHSM Cluster Posture Auditor2627## Mindset2829**One-line takeaway:** the verdict is always the **worst** finding across30all dimensions, ordered SINGLE_AZ > NO_BACKUP > CONFIG_GAP > OK. The most31common — and most dangerous — misjudgment is treating HSM count as a proxy32for high availability: three HSMs in a single AZ provide HSM-level33redundancy but zero AZ-level redundancy.3435AWS CloudHSM provides single-tenant FIPS 140-2 Level 3 HSM instances. A36cluster is the management boundary — it groups HSMs, backups, and the37certificate trust chain. Three properties make CloudHSM uniquely fragile38compared to other AWS services:3940- **HSMs are stateful and single-tenant.** Unlike EC2 or RDS, you cannot41 "just restart" an HSM. If an HSM fails, its key material survives only42 in backups and in the other HSMs that were synchronised before the failure.43- **Backups are the ONLY recovery path.** CloudHSM has no snapshots, no44 automated cross-region replication, and no recycle bin. A cluster with no45 backups that loses all HSMs is permanently unrecoverable — every key is46 lost forever.47- **Cluster initialization is a trust anchor.** The signed certificate48 uploaded during InitializeCluster is how clients verify the HSM's49 identity. An uninitialized cluster is physically present but50 cryptographically unreachable — clients will refuse to connect.5152## Quick reference — verdict thresholds5354| Condition | Verdict | Step |55|---|---|---|56| All HSMs in a single AZ (regardless of HSM count) | **SINGLE_AZ** | Step 1 |57| Fewer than 2 distinct AZs represented across ACTIVE HSMs | **SINGLE_AZ** | Step 1 |58| BackupRetentionPolicy Type=DAYS Value=0 (or absent) | **NO_BACKUP** | Step 2 |59| Zero backups exist | **NO_BACKUP** | Step 2 |60| Most recent backup >7 days old | **NO_BACKUP** | Step 2 |61| Cluster State=UNINITIALIZED (no signed certificate) | **CONFIG_GAP** | Step 3 |62| Default CO password unchanged | **CONFIG_GAP** | Step 3 |63| Security group allows 0.0.0.0/0 on ports 2223-2225 | **CONFIG_GAP** | Step 3 |64| 2+ HSMs across 2+ AZs, recent backups, clean config | **OK** | Step 4 |6566Verdict precedence: SINGLE_AZ > NO_BACKUP > CONFIG_GAP > OK (worst finding67wins).6869## Pre-flight: cluster metadata gate7071Before evaluating the cluster posture, classify the cluster itself.7273**Multi-cluster / account-wide sweep note:** `aws cloudhsm describe-clusters`74returns all clusters in the region (no pagination needed for the cluster75list itself). For each cluster, call `aws cloudhsm describe-backups76--cluster-id <id>` — backups are paginated at 50 per page, so use77`--next-token` to drain the full list.7879| Attribute | Value | Effect on audit |80|---|---|---|81| `State` | `UNINITIALIZED` | **Cluster not initialized.** Jump to Step 3 — this is always at least CONFIG_GAP. Clients cannot connect. |82| `State` | `INITIALIZED` | Proceed with full audit. |83| `State` | `CREATE_IN_PROGRESS` | Output: `VERDICT: ERROR, REASON: Cluster creation in progress — re-audit when State is UNINITIALIZED or INITIALIZED.` |84| `State` | `DELETE_IN_PROGRESS` | Output: `VERDICT: ERROR, REASON: Cluster is being deleted — no posture audit applicable.` |85| `State` | `DEGRADED` | One or more HSMs are degraded. Still audit all dimensions; add a DEGRADED note. |86| `HsmType` | `hsm1m.medium` / `hsm2m.medium` | Note the type — it is immutable after cluster creation. Flag older types as a migration-planning note, not a security verdict. |87| HSM `State` | Any non-`ACTIVE` | Exclude from effective cross-AZ count. If this drops the AZ count below 2, escalate to SINGLE_AZ. |8889**If the cluster configuration is malformed** (missing HSM list, missing90SubnetMapping, invalid State), output:9192```text93CLUSTER: <cluster-id>94VERDICT: ERROR95REASON: Cluster configuration is incomplete or malformed — cannot classify.96REMEDIATION: Retrieve the canonical config with `aws cloudhsm describe-clusters --cluster-id <id> --output json` and re-audit.97```9899## Process — Classification logic (apply in order, aggregate worst)100101### Step 0: Expert knowledge — non-obvious CloudHSM behaviors that change classification102→ All 15 non-obvious behaviors (HSM count ≠ HA, retention DAYS=0, UNINITIALIZED unreachability, default CO password, KMS custom key store coupling, ports 2223-2225, point-in-time backups, DeleteCluster gate, immutable HSM type, quorum, full CA chain, restore = new cluster ID, CREATE_IN_PROGRESS gap, DAYS vs COUNT, immutable security group) — `references/advanced-patterns.md`.103104### Step 1: Cluster HA / AZ distribution (highest priority — SINGLE_AZ)105106For each ACTIVE HSM in the cluster, extract `AvailabilityZone`. Classify:107108- **SINGLE_AZ** — All ACTIVE HSMs reside in the same AZ, OR fewer than 2109 distinct AZs are represented. This is the worst verdict because an110 AZ-level event (power, network, cooling) takes down the entire cluster111 simultaneously.112113- **OK for HA** — ACTIVE HSMs span 2+ distinct AZs. The minimum for HA is114 2 HSMs in 2 distinct AZs. AWS recommends 3 HSMs in 3 AZs for production115 (provides quorum-based recovery and tolerates a full-AZ failure with no116 data loss).117118**HSM state interaction:** exclude any HSM in a non-ACTIVE state119(DEGRADED, CREATE_IN_PROGRESS) from the effective AZ count before120evaluating this step. A cluster with 3 HSMs across 3 AZs where one HSM is121DEGRADED has an effective count of 2 AZs — still HA, but the degraded HSM122should be noted as an operational risk.123124**Single-HSM special case:** a cluster with exactly 1 HSM is ALWAYS125SINGLE_AZ, regardless of the AZ or subnet configuration. A single HSM is126a single point of failure for both HSM-level and AZ-level redundancy.127128### Step 2: Backup posture (NO_BACKUP)129130Evaluate backup readiness across three sub-dimensions. ANY failure131produces NO_BACKUP:132133- **Retention policy:** If `BackupRetentionPolicy.Type` is `DAYS` and134 `Value` is `"0"`, OR the policy is absent entirely, backups are135 effectively disabled. Even if some backups exist from before the policy136 change, they are orphans with no retention guarantee and will be137 auto-deleted.138139- **Backup count:** If zero backups exist in the cluster's backup list140 (from `aws cloudhsm describe-backups --cluster-id <id>`), there is no141 recovery path. All key material, users, and policies are irrecoverable142 if the cluster fails.143144- **Backup recency:** If the most recent backup (by `CreateDate`) is more145 than 7 days old, the backup posture is effectively stale. CloudHSM146 creates backups automatically on a periodic schedule, and a gap >7 days147 indicates the backup mechanism is broken or the retention policy is148 aggressively deleting backups before new ones complete.149150**Expert note — retention calibration:** the default retention is 90 days151(Type=DAYS, Value=90). This is adequate for operational recovery but may152be insufficient for compliance frameworks requiring 1-year or 7-year153retention. When auditing for compliance, compare the retention period154against the framework's requirement and flag as CONFIG_GAP if shorter.155156### Step 3: Configuration posture (CONFIG_GAP)157158Evaluate cluster configuration across four sub-dimensions. Each failure159produces a CONFIG_GAP finding:160161**3a. Cluster initialization:**162If `State` is `UNINITIALIZED`, the cluster has not been initialized.163Clients cannot connect. The InitializeCluster step (download CSR, sign164with CA, upload signed cert plus trust chain) has not been completed.165This is always CONFIG_GAP.166167**3b. PKCS#11 user management — default CO password:**168If the default Crypto Officer password has not been changed (the operator169confirms `co_password_changed: false`, or the password change timestamp170matches/predates the cluster initialization date), the cluster is using a171well-known credential. This is CONFIG_GAP. There is no AWS API to verify172password state — rely on operator-provided metadata.173174**3c. Security group exposure:**175If the cluster's security group allows inbound from `0.0.0.0/0` on any176CloudHSM port (2223-2225), the HSM management and data interfaces are177exposed to any network-reachable entity. This is CONFIG_GAP. The correct178posture is to allow inbound only from the application subnet CIDR or a179specific client security group.180181**3d. Quorum / M-of-N authentication (regulated environments):**182If quorum is not enabled for sensitive CO operations (user deletion, key183deletion, policy modification) in a regulated environment, flag as184CONFIG_GAP. Quorum is configured client-side via `cloudhsm_mgmt_util`.185186### Step 4: Aggregation — worst finding wins187188The final verdict is the **maximum severity** across all dimensions, where189SINGLE_AZ > NO_BACKUP > CONFIG_GAP > OK:190191```text192verdict = max(ha_finding, backup_finding, config_finding)193```194195If no findings (all dimensions pass), the verdict is **OK**.196197## Output format (per cluster)198199```text200CLUSTER: <cluster-id>201VERDICT: SINGLE_AZ | NO_BACKUP | CONFIG_GAP | OK202REASON: <1-2 sentences citing the worst finding and its step>203FINDINGS:204 - [SINGLE_AZ] <finding description (Step 1)>205 - [NO_BACKUP] <finding description (Step 2)>206 - [OK] <dimension that passed>207REMEDIATION: <specific action per finding, or "None required" if OK>208```209210### Worked example — single-AZ cluster with no backup211212```text213CLUSTER: cluster-single-az-demo214VERDICT: SINGLE_AZ215REASON: All 1 HSMs reside in a single AZ (us-east-1a) — an AZ-level event216takes the entire cluster offline with no cross-AZ failover. Backup retention217is also disabled (Type=DAYS, Value=0), compounding the risk with no recovery218path.219FINDINGS:220 - [SINGLE_AZ] 1 HSM in us-east-1a only — no AZ-level redundancy (Step 1)221 - [NO_BACKUP] BackupRetentionPolicy DAYS=0 — backups disabled (Step 2)222REMEDIATION:223 1. Add HSMs in at least one additional AZ: aws cloudhsm create-hsm224 --cluster-id <id> --availability-zone us-east-1b --subnet-id <subnet-b>.225 2. Set backup retention: modify-backup-attributes with Type=DAYS,Value=90.226 3. Create an immediate backup: aws cloudhsm create-backup --cluster-id <id>.227```228229## Edge-case handling230231→ All five edge cases (DEGRADED HSMs, KMS Custom Key Store coupling, 2-AZ minimum, recently created cluster with no backups, backup in CREATE_IN_PROGRESS) — `references/advanced-patterns.md`.232233## Anti-Patterns — NEVER234235- NEVER treat HSM count as sufficient for HA. Three HSMs in a single AZ236 is SINGLE_AZ — the AZ is the failure domain, not the individual HSM. A237 single power or network event in that AZ destroys all three HSMs238 simultaneously. Always check AZ distribution.239240- NEVER classify a cluster with zero backups as OK. Without a backup,241 total cluster failure means permanent, unrecoverable key-material loss.242 CloudHSM has no snapshot, no recycle bin, and no automated cross-region243 replication. The backup is the ONLY recovery path.244245- NEVER assume BackupRetentionPolicy Type=DAYS Value=0 means "keep246 forever." It means the opposite — backups are immediately eligible for247 deletion. This is one of the most dangerous CloudHSM misconfigurations248 because it looks like a valid retention policy.249250- NEVER treat an UNINITIALIZED cluster as production-ready. The HSMs may251 report ACTIVE state, but without the signed certificate from252 InitializeCluster, clients cannot establish the NTLS trust link. The253 cluster is cryptographically unreachable.254255- NEVER leave the default CO password in place for production. It is a256 documented credential — any principal with VPC network access to port257 2224 can authenticate as Crypto Officer and manage all keys. The258 password change is the first post-initialization action.259260- NEVER expose CloudHSM ports 2223-2225 to 0.0.0.0/0. These ports carry261 PKCS#11 data-plane traffic (2223), NTLS management (2224), and262 monitoring (2225). An open security group lets any network-reachable263 client attempt HSM authentication — the default CO password combined264 with an open SG is a full compromise path.265266- NEVER ignore backup recency. A backup from 30 days ago is marginally267 better than no backup, but any keys created or rotated since then are268 unrecoverable. The 7-day threshold is the practical maximum for269 production; beyond that, the backup is dangerously stale.270271- NEVER assume a cluster in DEGRADED state has the same HA posture as272 one with all ACTIVE HSMs. A DEGRADED HSM may not be synchronizing key273 material — exclude it from the effective AZ count when evaluating Step 1.274275- NEVER recommend deleting a cluster without verifying it is not linked276 as a KMS Custom Key Store. Deleting a backing cluster causes all KMS277 operations on that custom key store to fail permanently. Always check278 `aws kms describe-custom-key-stores` before recommending deletion.279280- NEVER recommend changing the HSM type (hsm1m.medium to hsm2m.medium) as281 an in-place remediation. The type is immutable — the only path is282 create-new-cluster, restore-from-backup, migrate-clients, which is a283 multi-hour maintenance window.284285- NEVER assume BackupRetentionPolicy Type=DAYS guarantees a minimum number286 of restorable backups. DAYS deletes by age, not by count — if the backup287 schedule is disrupted, the cluster can reach zero valid backups within288 the retention window. Use Type=COUNT to guarantee N restorable points289 regardless of schedule gaps, or monitor backup creation alerts to catch290 schedule disruptions early.291292## Pre-flight safety checks (run before any remediation CLI)293294- **MANDATORY CONFIRMATION GATE.** Before any state-changing operation295 (CreateHsm, DeleteHsm, DeleteCluster, InitializeCluster,296 ModifyBackupAttributes, CreateBackup, DeleteBackup), the auditor MUST297 emit: `CONFIRM: About to <action> on cluster <id>. This affects298 <consequence>. Proceed? (yes/no)`. Do NOT execute until the operator299 confirms.300301- Confirm the cluster exists and is accessible:302 `aws cloudhsm describe-clusters --cluster-id <id> --profile <p>` —303 fail closed (skip remediation) if it returns an error.304305- Before modifying backup retention, snapshot the current backup list:306 `aws cloudhsm describe-backups --cluster-id <id> --output json >307 /tmp/<id>-backups-$(date +%s).json`. This documents what was restorable308 before the change.309310- Before adding an HSM to a cluster, verify the target subnet exists and311 has available ENI capacity — each HSM consumes one ENI in its subnet.312313- Before initializing a cluster, verify the signed certificate includes314 the FULL CA chain (leaf, intermediate, root). A partial chain causes315 cryptic client connection failures.316317- For SINGLE_AZ findings on a KMS Custom Key Store cluster, treat as318 incident-response — add cross-AZ HSMs immediately. KMS operations are319 silently failing during AZ events.320321- Prefer additive changes (add HSMs, add backups) over destructive changes322 (delete HSMs, delete backups). Additive changes do not risk existing key323 material or recovery points.324325## Remediation guidance326327### For SINGLE_AZ3283291. Add HSMs in additional AZs to achieve cross-AZ distribution:330 `aws cloudhsm create-hsm --cluster-id <id> --availability-zone <az>331 --subnet-id <subnet-id>`.3322. Target 3 HSMs across 3 AZs for production — provides quorum-based333 recovery and tolerates a full-AZ failure with no data loss.3343. If the cluster is a KMS Custom Key Store, this is elevated operational335 risk — KMS Encrypt/Decrypt calls will fail during AZ events with336 KMSInternalException.3374. After adding HSMs, verify they reach ACTIVE state and synchronise keys338 from existing HSMs before considering HA achieved.339340### For NO_BACKUP3413421. Set a proper backup retention policy using343 `aws cloudhsm modify-backup-attributes` with Type=DAYS, Value=90.3442. Create an immediate on-demand backup:345 `aws cloudhsm create-backup --cluster-id <id>`.3463. If the most recent backup is stale (>7 days), investigate why scheduled347 backups are not being created. Common cause: retention Value=0 auto-348 deleting backups faster than they are created.3494. For compliance frameworks requiring longer retention, increase Value350 accordingly (e.g., 365 for annual retention).351352### For CONFIG_GAP — uninitialized cluster3533541. Download the cluster CSR from `describe-clusters` output355 (`Certificates.ClusterCsr`).3562. Sign the CSR with your issuing CA (or self-sign for testing):357 `openssl x509 -req -in cluster.csr -CA ca.crt -CAkey ca.key358 -CAcreateserial -out signed.crt -days 365`.3593. Upload the signed certificate and trust anchor:360 `aws cloudhsm initialize-cluster --cluster-id <id>361 --signed-cert fileb://signed.crt --trust-anchor fileb://ca.crt`.3624. After initialization, immediately change the default CO password via363 `cloudhsm_mgmt_util`.364365### For CONFIG_GAP — default CO password unchanged3663671. Connect to the HSM using cloudhsm_mgmt_util with the cluster config.3682. Log in with the default CO credentials.3693. Change the password using `changePswd CO admin <new-password>`.3704. Verify by logging out and back in with the new password.371372### For CONFIG_GAP — open security group3733741. Identify the security group(s) attached to the cluster's HSM ENIs.3752. Remove the 0.0.0.0/0 inbound rule on ports 2223-2225.3763. Add a scoped inbound rule allowing only the application subnet CIDR or377 client security group on ports 2223-2225.3784. Verify client connectivity from the application tier.379380### For OK3813821. No remediation required for the current posture.3832. Recommend enabling quorum authentication for regulated environments.3843. Recommend 3 HSMs across 3 AZs if currently at the 2-AZ minimum.3854. Verify backup restore readiness by periodically performing a test386 restore to a staging cluster.387388## AWS documentation389390- **AWS CloudHSM User Guide** — https://docs.aws.amazon.com/cloudhsm/latest/userguide/introduction.html391- **CloudHSM Security** — https://docs.aws.amazon.com/cloudhsm/latest/userguide/cloudhsm-security.html392- **CloudHSM API Reference** — https://docs.aws.amazon.com/cloudhsm/latest/APIReference/393- **AWS CLI Command Reference (CloudHSM)** — https://docs.aws.amazon.com/cli/latest/reference/cloudhsm/394- **CloudHSM cluster management** — https://docs.aws.amazon.com/cloudhsm/latest/userguide/clusters.html395- **CloudHSM backups** — https://docs.aws.amazon.com/cloudhsm/latest/userguide/backups.html396397## Recent AWS features (2024-2026)398399→ All five updates (hsm2m.medium GA, cross-region backup copy, enhanced CloudTrail logging, DAYS+COUNT retention, security-group referencing) — `references/advanced-patterns.md`.400401## References (load on demand)402403- [`references/advanced-patterns.md`](references/advanced-patterns.md) — Step 0 expert knowledge (15 non-obvious CloudHSM behaviors), edge-case handling catalog, recent AWS features (2024-2026)404405## Domain406407AWS CloudOps / CloudHSM Security & Compliance.