use of software.amazon.awssdk.services.kms.model.CreateAliasRequest in project aws-doc-sdk-examples by awsdocs.
the class CreateAlias method createCustomAlias.
// snippet-start:[kms.java2._create_alias.main]
public static void createCustomAlias(KmsClient kmsClient, String targetKeyId, String aliasName) {
try {
CreateAliasRequest aliasRequest = CreateAliasRequest.builder().aliasName(aliasName).targetKeyId(targetKeyId).build();
kmsClient.createAlias(aliasRequest);
} catch (KmsException e) {
System.err.println(e.getMessage());
System.exit(1);
}
}
Aggregations