Menu
AWS Key Management Service
Developer Guide

Creating a Client

To use the AWS SDK for Java, the AWS SDK for .NET, the AWS SDK for Python (Boto 3), the AWS SDK for Ruby, or the AWS SDK for PHP to write code that uses the AWS Key Management Service (AWS KMS) API, start by creating an AWS KMS client.

The client object that you create is used in the example code in the topics that follow.

JavaC#PythonRubyPHP
Java

To create an AWS KMS client in Java, use the client builder.

AWSKMS kmsClient = AWSKMSClientBuilder.defaultClient();

For more information about using the Java client builder, see the following resources.

C#
AmazonKeyManagementServiceClient kmsClient = new AmazonKeyManagementServiceClient();
Python
kms_client = boto3.client('kms')
Ruby
require 'aws-sdk-kms' # in v2: require 'aws-sdk' kmsClient = Aws::KMS::Client.new
PHP

To create an AWS KMS client in PHP, use an AWS KMS client object, and specify version 2014-11-01. For more information see the KMSClient class in the AWS SDK for PHP API Reference.

// Create a KMSClient $KmsClient = new Aws\Kms\KmsClient([ 'profile' => 'default', 'version' => '2014-11-01', 'region' => 'us-east-1' ]);