AWS Cryptography Internal KMS Library

1.11.2 · active · verified Thu Apr 16

aws-cryptography-internal-kms is an internal Python library published by Amazon Web Services. It is a low-level component, likely providing performance enhancements or specific cryptographic implementations for AWS KMS operations within other AWS SDK components like `botocore` or `boto3`. It is not intended for direct use by end-user applications, lacks public documentation, and its API is subject to change without notice. The current version is 1.11.2. Its release cadence is tied to other AWS SDK component updates.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart explicitly demonstrates how to interact with AWS KMS using `boto3`, which is the standard and recommended approach. The `aws-cryptography-internal-kms` library is an internal component and should not be used directly by end-user applications. The example lists KMS keys, requiring AWS credentials to be configured in the environment or via standard AWS configuration files.

# This library is NOT intended for direct use by end-user applications.
# The standard and recommended way to interact with AWS KMS is via boto3.

import os
import boto3

# Ensure AWS credentials are configured (e.g., via environment variables or ~/.aws/credentials)
# For example, by setting AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION_NAME
aws_region = os.environ.get('AWS_REGION_NAME', 'us-east-1')

# Instantiate a KMS client using boto3 (the recommended approach)
kms_client = boto3.client('kms', region_name=aws_region)

try:
    # Example: List up to 5 KMS keys
    response = kms_client.list_keys(Limit=5)
    print(f"Successfully listed {len(response['Keys'])} KMS keys using boto3.")
    # print(response)
except Exception as e:
    print(f"Error interacting with KMS via boto3: {e}")
    print("Please ensure your AWS credentials are configured correctly.")

# Attempting to directly use aws-cryptography-internal-kms is strongly discouraged.
# from aws_cryptography_internal_kms import aws_kms_client
# print("Direct import of aws-cryptography-internal-kms components is possible ")
# print("but is not recommended due to unstable API and lack of documentation.")

view raw JSON →