Creating a client - AWS Key Management Service

Creating a client

To use the AWS SDK for Java, the AWS SDK for .NET, the AWS SDK for Python (Boto3), the AWS SDK for Ruby, the AWS SDK for PHP, or the AWS SDK for JavaScript in Node.js 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.


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

AWSKMS kmsClient = AWSKMSClientBuilder.standard().build();

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

AmazonKeyManagementServiceClient kmsClient = new AmazonKeyManagementServiceClient();
kms_client = boto3.client('kms')
require 'aws-sdk-kms' # in v2: require 'aws-sdk' kmsClient =

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' ]);
const kmsClient = new AWS.KMS();