There are more AWS SDK examples available in the AWS Doc SDK Examples
Code examples for AWS KMS using AWS SDKs
The following code examples show you how to use AWS Key Management Service (AWS KMS) with an AWS software development kit (SDK).
Actions are code excerpts from larger programs and must be run in context. While actions show you how to call individual service functions, you can see actions in context in their related scenarios and cross-service examples.
Scenarios are code examples that show you how to accomplish a specific task by calling multiple functions within the same service.
More resources
AWS KMS Developer Guide – More information about AWS KMS.
AWS KMS API Reference – Details about all available AWS KMS actions.
AWS Developer Center
– Code examples that you can filter by category or full-text search. AWS SDK Examples
– GitHub repo with complete code in preferred languages. Includes instructions for setting up and running the code.
Code examples
- Actions
- Create a grant for a key
- Create a key
- Create a random byte string
- Create an alias for a key
- Decrypt ciphertext
- Delete an alias
- Describe a key
- Disable a key
- Enable a key
- Encrypt text using a key
- Generate a plaintext data key for client-side encryption
- Generate an encrypted data key
- Get a policy for a key
- List aliases for a key
- List grants for a key
- List keys
- List policies for a key
- Recencrypt ciphertext from one key to another
- Retire a grant for a key
- Revoke a grant for a key
- Schedule deletion of a key
- Set the policy for a key
- Update the key referred to by an alias
- Scenarios