简体   繁体   English

使用 AWS Lambda 和 Java 的 AWS SDK 进行秘密轮换

[英]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 .目前我正在研究一个用例,我们需要在AWS Secret Manager中存储private keyspublic certs We need to rotate the keys as well.我们还需要rotate密钥。 However I am not able to find any documentation where the lambda is created in java template.但是,我找不到任何在lambda模板中创建java的文档。 Is there any way where we can rotate the secrets using java in lambda ?有没有什么办法可以使用java中的lambda轮换secrets Or do you suggest any other alternatives for storage?或者您是否建议任何其他存储替代方案?

I could find the below documentation but its in python .我可以找到以下文档,但它在python中。

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

You can find how to use AWS SDK for Java V2 for Secrets Manager here:您可以在此处找到如何将AWS SDK 用于 Secrets Manager 的 Java V2

https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/javav2/example_code/secretsmanager 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:您可以在 Lambda function 中使用此 API 和其他 AWS 服务 API。我们在用例下有不同的示例:

https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/javav2 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:仔细查看,您会发现不同的用例示例,向您展示如何在 Lambda function 中使用服务 Java API。例如,这是一个很好的示例:

Creating an AWS Lambda function that detects images with Personal Protective Equipment 创建一个 AWS Lambda function 来检测带有个人防护设备的图像

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.这向您展示了如何将 AWS SDK 用于 Lambda function 中的 Java V2。一旦您理解了这一点,您就可以在 Lambda 883540888 中使用其他 AWS Java APIs -- 比如 Secret Managers86。

If you have questions, add a comment below.如果您有任何疑问,请在下方添加评论。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM