ghostrider
ghostrider

Reputation: 2238

Secrets Rotation using AWS Lambda and the AWS SDK for Java

Currently I am working on a use case where we need to store the private keys and public certs in AWS Secret Manager. We need to rotate the keys as well. However I am not able to find any documentation where the lambda is created in java template. Is there any way where we can rotate the secrets using java in lambda? Or do you suggest any other alternatives for storage?

I could find the below documentation but its in python.

https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_available-rotation-templates.html

Upvotes: 1

Views: 1126

Answers (1)

smac2020
smac2020

Reputation: 10704

You can find how to use AWS SDK for Java V2 for Secrets Manager here:

https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/javav2/example_code/secretsmanager

You can use this API and other AWS Services APIs within a Lambda function. We have different examples here under use cases:

https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/javav2

Look through that can you will find different use case examples that show you how to use a Service Java API within a Lambda function. For example, this is a good example:

Creating an AWS Lambda function that detects images with Personal Protective Equipment

This shows you HOW TO use AWS SDK for Java V2 within a Lambda function. Once you understand that -- you can use other AWS Java Apis within a Lambda function -- such as Secrets Manager.

If you have questions, add a comment below.

Upvotes: 1

Related Questions