Skip to main content

CreateKey

Creates a unique customer managed KMS key in your QConsole account.

Description

Creates a customer managed KMS key in your QConsole account. You can use a KMS key to encrypt small amounts of data (up to 4,096 bytes) directly, but KMS keys are more commonly used to encrypt data encryption keys (DEKs) which are then used to encrypt larger amounts of data.

Request Syntax

Headers

NameDescriptionRequiredType
Content-TypeMust be "application/x-amz-json-1.1"Yesstring
X-Amz-TargetMust be "TrentService.CreateKey"Yesstring

Request Body

NameDescriptionRequiredType
PolicyThe key policy to attach to the KMS key. If you do not specify a policy, Q-KMS attaches a default key policy that gives all principals in the QConsole account access to all KMS operations.Nostring
DescriptionA description of the KMS key. Use a description that helps you decide whether the KMS key is appropriate for a task.Nostring
KeyUsageDetermines the cryptographic operations for which you can use the KMS key. The default value is ENCRYPT_DECRYPT. This parameter is required only for asymmetric KMS keys.Nostring
CustomerMasterKeySpecSpecifies the type of KMS key to create. The default value, SYMMETRIC_DEFAULT, creates a KMS key with a 256-bit symmetric key for encryption and decryption.Nostring
OriginThe source of the key material for the KMS key. You cannot change the origin after you create the KMS key. The default is AWS_KMS, which means Q-KMS creates the key material.Nostring
BypassPolicyLockoutSafetyCheckA flag to indicate whether to bypass the key policy lockout safety check. The default value is false.Noboolean
TagsOne or more tags. Each tag consists of a tag key and a tag value.Noarray
POST / HTTP/1.1
Content-Type: application/x-amz-json-1.1
X-Amz-Target: TrentService.CreateKey
{ "Description": "Example KMS key for general use", "KeyUsage": "ENCRYPT_DECRYPT", "CustomerMasterKeySpec": "SYMMETRIC_DEFAULT", "Origin": "QKMS", "Tags": [ { "TagKey": "Purpose", "TagValue": "Test" } ] }
Values in italics indicate user input and should be replaced with actual values.

Response Elements

NameDescriptionRequiredType
KeyMetadataMetadata associated with the KMS key.NoString

Examples

Example 1: Create a symmetric encryption KMS key

POST / HTTP/1.1
Content-Type: application/x-amz-json-1.1
X-Amz-Target: TrentService.CreateKey
{ "Description": "Example symmetric encryption KMS key", "KeyUsage": "ENCRYPT_DECRYPT", "CustomerMasterKeySpec": "SYMMETRIC_DEFAULT" }
Values in italics indicate user input and should be replaced with actual values.
HTTP/1.1 200 OK
Content-Type: application/x-amz-json-1.1
{ "KeyMetadata": { "AccountId": "111122223333", "KeyId": "1234abcd-12ab-34cd-56ef-1234567890ab", "Arn": "arn:verenc:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab", "CreationDate": "2023-12-01T00:00:00-07:00", "Enabled": true, "Description": "Example symmetric encryption KMS key", "KeyUsage": "ENCRYPT_DECRYPT", "KeyState": "Enabled", "Origin": "QKMS", "CustomerMasterKeySpec": "SYMMETRIC_DEFAULT", "MultiRegion": false } }
Values in italics indicate variable response values.

Example 2: Create a multi-Region primary key

POST / HTTP/1.1
Content-Type: application/x-amz-json-1.1
X-Amz-Target: TrentService.CreateKey
{ "Description": "Example multi-Region primary key", "MultiRegion": true, "KeyUsage": "ENCRYPT_DECRYPT", "CustomerMasterKeySpec": "SYMMETRIC_DEFAULT" }
Values in italics indicate user input and should be replaced with actual values.
HTTP/1.1 200 OK
Content-Type: application/x-amz-json-1.1
{ "KeyMetadata": { "AccountId": "111122223333", "KeyId": "mrk-1234abcd12ab34cd56ef1234567890ab", "Arn": "arn:verenc:111122223333:key/mrk-1234abcd12ab34cd56ef1234567890ab", "CreationDate": "2023-12-01T00:00:00-07:00", "Enabled": true, "Description": "Example multi-Region primary key", "KeyUsage": "ENCRYPT_DECRYPT", "KeyState": "Enabled", "Origin": "QKMS", "CustomerMasterKeySpec": "SYMMETRIC_DEFAULT", "MultiRegion": true } }
Values in italics indicate variable response values.

Special Errors

Error CodeDescription
DependencyTimeoutExceptionThe system timed out while trying to fulfill the request.
InvalidArnExceptionThe request was rejected because a specified ARN was not valid.
KMSInternalExceptionThe request was rejected because an internal error occurred.
LimitExceededExceptionThe request was rejected because a quota was exceeded.
MalformedPolicyDocumentExceptionThe request was rejected because the specified policy document was malformed.
TagExceptionThe request was rejected because one or more tags are not valid.
UnsupportedOperationExceptionThe request was rejected because a specified parameter is not supported or a specified resource is not valid for this operation.

Permissions

To use the `CreateKey` operation, you must have the following permissions:

  • `kms:CreateKey`
  • `iam:CreateServiceLinkedRole` (required only to create multi-Region keys)

Try It Out

Test CreateKey

Create a new KMS key in your QConsole account.

Coming Soon

This feature is currently under development and will be available soon.