KMSClient.create_key
rboto-kms==0.4.0 · Service index · Types
Model summary (excerpt): Creates a unique customer managed KMS key in your Amazon Web Services account and Region. You can use a KMS key in cryptographic operations, such as encryption and signing. Some Amazon Web Services services let you use KMS keys that you create and manage to protect your service resources. A KMS key is a logical representation of a cryptographic key. In addition to the key material used in...
Install and imports
from rboto import KMSClient
from collections.abc import Sequence
from rboto_kms.types import (
CreateKeyOutput,
CustomerMasterKeySpec,
KeySpec,
KeyUsageType,
OriginType,
Tag,
)
Signature
async def create_key(
*,
policy: str | None = None,
description: str | None = None,
key_usage: KeyUsageType | None = None,
customer_master_key_spec: CustomerMasterKeySpec | None = None,
key_spec: KeySpec | None = None,
origin: OriginType | None = None,
custom_key_store_id: str | None = None,
bypass_policy_lockout_safety_check: bool | None = None,
tags: Sequence[Tag] | None = None,
multi_region: bool | None = None,
xks_key_id: str | None = None,
) -> CreateKeyOutput: ...
Arguments without defaults are required. None omits an optional request argument. Static types do not validate resource existence, permissions, lengths, ranges, or conditional service requirements.
Arguments
| Argument | Required | Model notes (excerpt) |
|---|---|---|
policy |
No | The key policy to attach to the KMS key. If you provide a key policy, it must meet the following criteria: The key policy must allow the calling principal to make a subsequent PutKeyPolicy request on the KMS key. This reduces the risk that the KMS key becomes unmanageable. For more information, see Default key policy in the Key Management Service Developer Guide . (To omit this condition, set... |
description |
No | A description of the KMS key. Use a description that helps you decide whether the KMS key is appropriate for a task. The default value is an empty string (no description). Do not include confidential or sensitive information in this field. This field may be displayed in plaintext in CloudTrail logs and other output. To set or change the description after the key is created, use... |
key_usage |
No | Determines the cryptographic operations for which you can use the KMS key. The default value is ENCRYPT_DECRYPT . This parameter is optional when you are creating a symmetric encryption KMS key; otherwise, it is required. You can't change the KeyUsage value after the KMS key is created. Each KMS key can have only one key usage. This follows key usage best practices according to NIST SP 800-57... |
customer_master_key_spec |
No | Instead, use the KeySpec parameter. The KeySpec and CustomerMasterKeySpec parameters work the same way. Only the names differ. We recommend that you use KeySpec parameter in your code. However, to avoid breaking changes, KMS supports both parameters. |
key_spec |
No | Specifies the type of KMS key to create. The default value, SYMMETRIC_DEFAULT , creates a KMS key with a 256-bit AES-GCM key that is used for encryption and decryption, except in China Regions, where it creates a 128-bit symmetric key that uses SM4 encryption. For a detailed description of all supported key specs, see Key spec reference in the Key Management Service Developer Guide . The... |
origin |
No | The 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 that KMS creates the key material. To create a KMS key with no key material (for imported key material), set this value to EXTERNAL . For more information about importing key material into KMS, see Importing Key Material in the Key Management Service... |
custom_key_store_id |
No | Creates the KMS key in the specified custom key store . The ConnectionState of the custom key store must be CONNECTED . To find the CustomKeyStoreID and ConnectionState use the DescribeCustomKeyStores operation. This parameter is valid only for symmetric encryption KMS keys in a single Region. You cannot create any other type of KMS key in a custom key store. When you create a KMS key in an... |
bypass_policy_lockout_safety_check |
No | Skips ("bypasses") the key policy lockout safety check. The default value is false. Setting this value to true increases the risk that the KMS key becomes unmanageable. Do not set this value to true indiscriminately. For more information, see Default key policy in the Key Management Service Developer Guide . Use this parameter only when you intend to prevent the principal that is making the... |
tags |
No | Assigns one or more tags to the KMS key. Use this parameter to tag the KMS key when it is created. To tag an existing KMS key, use the TagResource operation. Do not include confidential or sensitive information in this field. This field may be displayed in plaintext in CloudTrail logs and other output. Tagging or untagging a KMS key can allow or deny permission to the KMS key. For details, see... |
multi_region |
No | Creates a multi-Region primary key that you can replicate into other Amazon Web Services Regions. You cannot change this value after you create the KMS key. For a multi-Region key, set this parameter to True . For a single-Region KMS key, omit this parameter or set it to False . The default value is False . This operation supports multi-Region keys , an KMS feature that lets you create... |
xks_key_id |
No | Identifies the external key that serves as key material for the KMS key in an external key store . Specify the ID that the external key store proxy uses to refer to the external key. For help, see the documentation for your external key store proxy. This parameter is required for a KMS key with an Origin value of EXTERNAL_KEY_STORE . It is not valid for KMS keys with any other Origin value.... |
Output
CreateKeyOutput.
Read-only native attributes, accessed as response.field. Collection getters materialize Python values; to_dict() recursively materializes a mapping. Streams are consumed once.
| Field | Type | Presence | References |
|---|---|---|---|
key_metadata |
KeyMetadataOutput | None |
Always present | KeyMetadataOutput |
| None means a value can be absent. Output mappings include every declared key; optional input keys may be omitted. Unknown output enum/union variants are not automatically valid inputs.
Related types
CreateKeyOutput, CustomerMasterKeySpec, KeySpec, KeyUsageType, OriginType, Tag
Follow these links for nested inputs and outputs; recursive types link back to the same type page.
Pagination and streaming
No generated paginator for this operation.
No output stream.
Errors
Import from rboto_kms.exceptions:
CloudHsmClusterInvalidConfigurationError, CustomKeyStoreInvalidStateError, CustomKeyStoreNotFoundError, DependencyTimeoutError, InvalidArnError, KMSInternalError, LimitExceededError, MalformedPolicyDocumentError, TagError, UnsupportedOperationError, XksKeyAlreadyInUseError, XksKeyInvalidConfigurationError, XksKeyNotFoundError.
Other service failures use the service base error; credential, transport and timeout failures use shared errors.