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.

Java

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.

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