Menu
AWS Key Management Service
Developer Guide

Importing Key Material Step 4: Import the Key Material

After you encrypt your key material, you can import the key material to use with an AWS KMS customer master key (CMK). To import key material, you upload the encrypted key material from Step 3: Encrypt the Key Material and the import token that you downloaded at Step 2: Download the Public Key and Import Token. You must import key material into the same CMK that you specified when you downloaded the public key and import token.

When you import key material, you can optionally specify a time at which the key material expires. When the key material expires, AWS KMS deletes the key material and the CMK becomes unusable. To use the CMK again, you must reimport key material.

After you successfully import key material, the CMK's key state changes to enabled, and you can use the CMK.

To import key material, you can use the AWS Management Console or the AWS KMS API. You can use the API directly by making HTTP requests, or through one of the AWS SDKs or command line tools.

Import Key Material (AWS Management Console)

You can use the AWS Management Console to import key material. If you just completed the optional final step of downloading the public key and import token with the console, skip to Step 5.

To import key material (console)

  1. Open the Encryption Keys section of the Identity and Access Management (IAM) console at https://console.aws.amazon.com/iam/home#encryptionKeys.

  2. For Region, choose the appropriate AWS region. Do not use the region selector in the navigation bar (top right corner).

  3. Choose the alias of the CMK for which you downloaded the public key and import token.

  4. In the Key Material section of the page, choose Upload key material.

  5. In the Specify key material details section, for Encrypted key material, choose the file that contains your encrypted key material. For Import token, choose the file that contains the import token that you downloaded previously.

  6. In the Choose an expiration option section, choose whether the key material expires. If you choose expiration, type a date and a time in the corresponding boxes.

  7. Choose Finish or Upload key material.

Import Key Material (AWS KMS API)

To use the AWS KMS API to import key material, send an ImportKeyMaterial request. The following example shows how to do this with the AWS CLI.

This example specifies an expiration time for the key material. To import key material with no expiration, replace KEY_MATERIAL_EXPIRES with KEY_MATERIAL_DOES_NOT_EXPIRE and omit the --valid-to parameter. Replace 1234abcd-12ab-34cd-56ef-1234567890ab with the key ID of the CMK for which you downloaded the public key and import token. You can use the CMK's key ID or ARN but you cannot use an alias for this operation. Replace EncryptedKeyMaterial.bin and ImportToken.bin with the names of the files that contain the encrypted key material and the import token, respectively.

Copy
$ aws kms import-key-material --key-id 1234abcd-12ab-34cd-56ef-1234567890ab \ --encrypted-key-material fileb://EncryptedKeyMaterial.bin \ --import-token fileb://ImportToken.bin \ --expiration-model KEY_MATERIAL_EXPIRES \ --valid-to 2016-11-08T12:00:00-08:00