AWS Code Sample

The AWS Documentation website is getting a new look!
Try it now and let us know what you think. Switch to the new look >>

You can return to the original look by selecting English in the language selector above. demonstrates how to delete an alias.

package aws.example.kms; import; import; import; public class DeleteAlias { public static void main(String[] args) { final String USAGE = "To run this example, supply an alias name\n" + "Usage: DeleteAlias <alias-name>\n" + "Example: DeleteAlias alias/projectKey1\n"; if (args.length != 1) { System.out.println(USAGE); System.exit(1); } String aliasName = args[0]; AWSKMS kmsClient = AWSKMSClientBuilder.standard().build(); // Delete an alias for a CMK DeleteAliasRequest req = new DeleteAliasRequest().withAliasName(aliasName); kmsClient.deleteAlias(req); } }

Sample Details

Service: kms

Last tested: 2019-04-09

Author: AWS

Type: full-example

On this page: