Imported Key Material and External Key Stores

5 minutes 5 Questions

Imported Key Material and External Key Stores are AWS KMS options for organizations that need more control over cryptographic keys than standard AWS-generated keys provide. Imported Key Material (Bring Your Own Key, BYOK): You create a KMS key with origin EXTERNAL, which has no key material at first. You then download a public wrapping key and an import token, which is valid for 24 hours. Next, you wrap key material generated in your own HSM or key management system and import it into KMS. Exam-relevant points: you can set an expiration date on the material; you can delete it on demand with DeleteImportedKeyMaterial, making the key unusable right away instead of waiting 7-30 days for scheduled key deletion. You can restore the key only by reimporting the exact same material. AWS cannot recover lost material, so you must keep a secure copy and maintain durability yourself. Automatic yearly rotation is not available; rotate manually or with on-demand rotation where supported. Use imported material when compliance requires proof of key origin, independent backups, or instant revocation. External Key Stores (XKS, Hold Your Own Key): An XKS is a custom key store whose keys live in an external key manager outside AWS. KMS reaches it through an XKS proxy you operate, which implements the AWS XKS Proxy API, over a public endpoint or VPC endpoint service connectivity. Key material never leaves your external manager; KMS sends encrypt and decrypt requests to the proxy. Data is double encrypted, first by KMS HSM-backed material and then by your external key. Only symmetric encryption keys are supported. Trade-offs: you own availability, latency, and durability; if the proxy or external manager fails, integrated services such as S3 or EBS cannot decrypt data. You can revoke AWS access by cutting proxy access. Exam tip: choose CloudHSM key stores for single-tenant HSMs within AWS, imported material for key origin control, and XKS when regulations require keys to remain outside AWS.

Imported Key Material and External Key Stores in AWS KMS: A Complete Guide for the AWS Certified Security Specialty Exam

Overview
AWS Key Management Service (KMS) normally generates and stores the cryptographic material behind every KMS key inside FIPS 140-3 validated hardware security modules (HSMs) that AWS operates. Some organizations, however, face regulatory, contractual or internal policy requirements that call for more ownership and control over their keys. AWS answers these needs with two features that appear frequently on the AWS Certified Security - Specialty exam:

1. Imported Key Material, often called Bring Your Own Key (BYOK).
2. External Key Stores (XKS), often called Hold Your Own Key (HYOK).

Both sit within the Data Protection domain and test whether you understand the trade-offs between control, durability, availability, operational burden and cost.

Why It Is Important
- Regulatory compliance: Some regulations, sovereignty rules or industry frameworks require that key material be generated in a customer-controlled source of entropy, or that keys never reside in the cloud provider's infrastructure.
- Control over key lifecycle: Organizations may want the ability to remove key material on demand, set an expiration date, or keep the authoritative copy of a key on premises.
- Revocation and kill switch: With both options the customer can render encrypted data unreadable by deleting imported material or by disconnecting an external key store.
- Separation of duties: Security teams can keep key generation and storage outside the AWS account while application teams still use native AWS service integrations such as Amazon S3, Amazon EBS and Amazon RDS.
- Exam relevance: Scenario questions often describe a compliance requirement and ask you to choose between AWS-generated keys, imported key material, an AWS CloudHSM key store or an external key store. Choosing correctly requires understanding exactly what each feature does and what responsibilities it shifts to the customer.

What Imported Key Material Is
Imported key material lets you create a KMS key that has no key material at creation time and then load your own key material, generated in your own on-premises HSM or key management infrastructure, into AWS KMS.

Key characteristics:
- The KMS key is created with an origin of EXTERNAL (in the console, 'External (Import key material)').
- Supported key types: symmetric encryption keys, asymmetric keys (RSA, ECC, SM2 in China Regions) and HMAC keys.
- The key material, once imported, lives inside the AWS KMS HSMs and is used just like AWS-generated material. All cryptographic operations happen inside AWS KMS.
- Imported key material is supported for multi-Region keys; you must import the same key material into the primary key and each replica.
- Imported key material is not supported in custom key stores (AWS CloudHSM key stores or external key stores).

How Imported Key Material Works
Step 1 - Create a KMS key with no key material. Call CreateKey with Origin=EXTERNAL. The key enters the PendingImport state and cannot be used yet.

Step 2 - Download the wrapping public key and import token. Call GetParametersForImport. You choose:
- A wrapping key spec: RSA_2048, RSA_3072 or RSA_4096 (SM2 in China Regions).
- A wrapping algorithm: RSAES_OAEP_SHA_1, RSAES_OAEP_SHA_256, RSA_AES_KEY_WRAP_SHA_1 or RSA_AES_KEY_WRAP_SHA_256. The RSA_AES_KEY_WRAP options are required when importing larger material such as RSA private keys.
AWS returns a public wrapping key and an import token. Both are valid for 24 hours. The import token ties the wrapped material to this specific KMS key.

Step 3 - Encrypt (wrap) your key material. In your own HSM or tooling (for example OpenSSL), encrypt the key material with the downloaded public wrapping key using the chosen algorithm. The key material is therefore never exposed in plaintext in transit.

Step 4 - Import the key material. Call ImportKeyMaterial, passing the wrapped material, the import token, and an expiration model:
- KEY_MATERIAL_EXPIRES with a ValidTo date, after which AWS KMS deletes the material and the key becomes unusable.
- KEY_MATERIAL_DOES_NOT_EXPIRE.
The key moves to the Enabled state.

Step 5 - Manage the lifecycle.
- DeleteImportedKeyMaterial removes the material at once; the key returns to PendingImport and all data protected by it cannot be decrypted until you reimport.
- You can reimport the same key material later to restore access. Historically, a KMS key could only ever accept the exact same material it was first given; AWS has since added on-demand rotation for symmetric keys with imported material, where you import new material and rotate to it manually. Automatic rotation is not available for imported key material.
- The traditional way to rotate is manual rotation: create a new KMS key, import new material, and repoint an alias to it.

Shared Responsibility for Imported Key Material
- Durability is your responsibility. AWS KMS does not keep a durable backup that you can recover after deletion or expiration. You must keep a secure copy of the key material outside AWS. If you lose your copy and the material is deleted or expires, the encrypted data is lost permanently.
- Entropy and generation quality are your responsibility.
- AWS still manages the HSMs, availability and performance of cryptographic operations once the material is imported.

What External Key Stores Are
An external key store is a type of custom key store backed by a key manager that you own and operate outside AWS, such as an on-premises HSM or a third-party key manager. The KMS keys you create in an external key store (called XKS keys) are associated with an external key that never leaves your key manager. Every encryption or decryption request that uses an XKS key requires a call out to your external key manager.

Key characteristics:
- Only symmetric encryption keys are supported. No asymmetric, HMAC, imported material or multi-Region keys.
- The key material never leaves your HSM and is never stored in AWS.
- You use the same AWS KMS APIs and integrated AWS services, so applications need no change.
- Introduced to meet strict sovereignty and HYOK requirements.

How External Key Stores Work
1. External key store proxy (XKS proxy). You run a proxy that implements the published AWS KMS External Key Store Proxy API specification. The proxy receives requests from AWS KMS and translates them to your external key manager. Many HSM vendors provide a ready-made proxy.

2. Connectivity options.
- Public endpoint connectivity: AWS KMS reaches the proxy over the internet using HTTPS (TLS 1.2 or later).
- VPC endpoint service connectivity: the proxy sits behind a Network Load Balancer exposed as an AWS PrivateLink endpoint service in your VPC. This is often preferred for security since traffic stays on private networking, and your VPC can connect to on-premises via AWS Direct Connect or VPN.

3. Authentication. AWS KMS signs every request to the proxy with AWS Signature Version 4 (SigV4) using a proxy authentication credential (access key ID and secret) that you create on the proxy and register with AWS KMS. You should rotate this credential regularly.

4. Double encryption. When you call Encrypt or GenerateDataKey with an XKS key, AWS KMS first encrypts the data with internal AWS KMS key material unique to the XKS key, then sends that ciphertext to your proxy to be encrypted again with the external key. Decryption reverses the process. This means that neither AWS nor your external key manager alone can decrypt the data.

5. Connection state. You must connect the external key store (states include CONNECTED, CONNECTING, DISCONNECTED, FAILED). When you disconnect it, or when your proxy or HSM becomes unreachable, all XKS keys become unusable. This acts as a kill switch.

6. Auditing. AWS KMS calls are logged in AWS CloudTrail, and your proxy and key manager can produce their own logs, giving you an independent audit trail. Amazon CloudWatch metrics show proxy latency and errors.

Shared Responsibility for External Key Stores
- Availability, latency and durability are entirely your responsibility. AWS KMS expects the proxy to respond within a short timeout (around 250 milliseconds); slow or failing responses cause AWS service operations to fail.
- Performance and throughput: external key stores are subject to request quotas and depend on your HSM capacity.
- Rotation: automatic key rotation in AWS KMS is not supported; rotation is handled in your external key manager or by creating new XKS keys and updating aliases.
- Cost and complexity: you operate HSMs, the proxy, networking and monitoring.
- AWS recommends XKS only when you have a clear regulatory need; for most workloads standard KMS keys are more available, faster and cheaper.

Comparison of Key Origin Options
AWS_KMS (default): AWS generates and stores material in AWS KMS HSMs; automatic rotation supported; highest availability; least operational effort.
EXTERNAL (imported material): you generate the material; it is stored in AWS KMS HSMs after import; you keep the backup; you can set expiration or delete it on demand; no automatic rotation.
AWS_CLOUDHSM (CloudHSM key store): material generated and stored in a single-tenant AWS CloudHSM cluster you control, inside AWS; useful when keys must be in dedicated single-tenant HSMs you manage; no automatic rotation.
EXTERNAL_KEY_STORE (XKS): material stays in your HSM outside AWS; double encryption; you own availability and latency; symmetric keys only.

Common Scenario Patterns
- 'Company must generate keys using its own on-premises HSM and be able to remove them from AWS at any time.' Choose imported key material and use DeleteImportedKeyMaterial.
- 'Key material must automatically be deleted after a set date.' Choose imported key material with an expiration date.
- 'Keys must never be stored in or leave the company's data center, yet S3 and EBS encryption must keep working.' Choose an external key store.
- 'Keys must be in a single-tenant HSM the company controls, but can be inside AWS.' Choose an AWS CloudHSM key store.
- 'Need automatic annual rotation with least operational overhead.' Choose a standard AWS KMS customer managed key with automatic rotation enabled.
- 'After importing, the key shows PendingImport.' The material was deleted or has expired; reimport the same material using a new import token.
- 'Import fails.' Check for an expired import token or wrapping key (24 hours), the wrong wrapping algorithm, or material that does not match the key spec.

Exam Tips: Answering Questions on Imported Key Material and External Key Stores
1. Match the requirement keyword to the feature. 'Generate keys ourselves' or 'bring our own key' points to imported key material. 'Keys must remain outside AWS' or 'hold your own key' points to an external key store. 'Single-tenant HSM in AWS' points to a CloudHSM key store.
2. Remember who owns durability. With imported material, AWS cannot recover deleted or expired material; the customer must retain a copy. Any answer suggesting AWS can restore it is wrong.
3. Remember who owns availability. With XKS, outages, network problems or high latency in the proxy or HSM break AWS service operations. If a question highlights high availability with low operational effort, XKS is usually the wrong choice.
4. Know the 24-hour rule. The wrapping public key and import token from GetParametersForImport expire after 24 hours.
5. Rotation facts. Automatic rotation is supported only for symmetric keys with AWS_KMS origin. For imported material and custom key stores, rotate manually by creating a new key and updating the alias (or use on-demand rotation for symmetric imported keys where available).
6. Deletion behavior differs. DeleteImportedKeyMaterial takes effect at once and can be reversed by reimporting. ScheduleKeyDeletion uses a 7 to 30 day waiting period and is permanent once complete.
7. XKS supports only symmetric encryption keys. If a scenario needs asymmetric signing or HMAC with keys outside AWS, XKS is not the answer.
8. Double encryption is a distinguishing trait. If a question asks how XKS ensures neither party alone can decrypt data, the answer is double encryption with KMS internal material plus the external key.
9. Connectivity security. For XKS, prefer VPC endpoint service (PrivateLink) connectivity when the question emphasizes keeping traffic off the public internet; requests are always authenticated with SigV4 and protected with TLS.
10. Kill switch questions. To revoke access quickly: delete imported key material, disable the key, or disconnect the external key store. Be aware that some services cache data keys (for example S3 Bucket Keys or mounted EBS volumes) so access may persist briefly until the cache expires or the volume is detached.
11. Least privilege on key operations. Use key policies and IAM to restrict kms:ImportKeyMaterial, kms:DeleteImportedKeyMaterial, kms:GetParametersForImport and custom key store APIs such as kms:ConnectCustomKeyStore to security administrators only.
12. Auditing. CloudTrail records ImportKeyMaterial, DeleteImportedKeyMaterial and expiration events; for XKS you also have independent proxy and HSM logs. Use EventBridge rules on these CloudTrail events for alerting.
13. Eliminate distractors. Watch for answers claiming you can export key material from KMS (you cannot), import material into a CloudHSM or external key store (not supported), or import different material into a key that already used other material for decryption needs (data encrypted under old material requires that same material).
14. Prefer the simplest compliant option. AWS exam answers favor the least operational overhead that still meets the stated requirement. Only choose imported material or XKS when the question explicitly demands customer-generated or customer-held keys.

Summary
Imported key material gives you control over key generation, expiration and removal while AWS KMS still performs cryptography inside its own HSMs; you must keep a durable copy. External key stores keep keys entirely in your own infrastructure with double encryption, giving maximum control at the cost of availability, latency and operational complexity that you must manage. On the exam, read each scenario for clues about where keys are generated, where they must reside, who must be able to revoke them and how much operational effort is acceptable, then map those clues to the correct feature.
Test mode:
More Imported Key Material and External Key Stores questions
32 questions (total)