curena
8/27/2015 - 6:50 PM

Creating an AWS KMS client

Creating an AWS KMS client

package com.amazon.kms;

import java.io.File;
import java.io.IOException;
import java.nio.ByteBuffer;

import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.PropertiesCredentials;
import com.amazonaws.services.kms.AWSKMS;
import com.amazonaws.services.kms.AWSKMSClient;
import com.amazonaws.services.kms.model.*;

public class kmsSDKExample {

    private final AWSKMSClient kms;

    public kmsSDKExample() {
        kms = getClient();
    }

    public static void main(String[] args) {
        new kmsSDKExample();
    }

    private AWSKMS getClient() {
        final AWSCredentials creds;

        AWSKMSClient kms = new AWSKMSClient(creds);
        
        .
        .
        .

        kms.setEndpoint("https://kms.us-east-1.amazonaws.com");

        return kms;
    }
    
    .
    .
    .
    
}