使用Lambda时的AWS System Manager参数存储vs Secrets Manager vs Lambda中的环境变化 [英] AWS System Manager Parameter Store vs Secrets Manager vs Environment Variation in Lambda, when to use which

查看:89
本文介绍了使用Lambda时的AWS System Manager参数存储vs Secrets Manager vs Lambda中的环境变化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

遇到了一些特定的用例,我对使用这些用例有些困惑:

Encountered a few speicific use cases that I'm somewhat confused to use which:

  1. 大量免费的公共API密钥.通过结合使用lambda环境变量,其他开发人员/管理员仍可以在lambds控制台中公开其纯文本值.应该改为使用参数存储吗?
  2. 将凭据登录到第三方平台.我认为秘密管理器是唯一的选择吗?
  3. 数据库连接字符串.机密经理?以每月$ 0.40/秘密/月的价格,该账单将增加数百个DB的数量,仅用于存储凭据.

推荐答案

要存储任何凭证,您可以选择三个AWS托管选项:

For storing any credentials you have three AWS managed choices:

Lambda环境变量

这些将直接通过Lambda服务传递到Lambda函数中.您可以通过控制其他人的通过IAM进入KMS的权限.这将在所有选项中提供最佳性能(在代码运行时中没有其他查找).

These will be passed into the Lambda function directly via the Lambda Service. You can prevent others accessing the string values by controlling their permissions to KMS via IAM. This will provide the best performance out of any options (there's no additional lookup in the code runtime).

通过使用此选项,请注意以下陷阱:

By using this option be aware of the following pitfalls:

  • 如果您对Lambda函数使用版本控制,则其值是固定的,则需要部署Lambda函数的新版本以进行更改.
  • 值附加到单个Lambda函数,如果键被多个使用,则需要分别传递给每个函数.

系统管理器参数存储

使用此选项,您将使用SDK检索所需的任何键/值.它既可以存储纯文本值,也可以存储加密的字符串(

Using this option you would use the SDK to retrieve any key/values that you want. It can store both plain text values as well encrypted strings (the SecureString type). It provides basic functionality but if that is all you need then it will work great. It costs nothing to store the values, but the price is $0.05 per 10,000 Parameter Store API interactions. Unlike environment variables you can use the value across multiple Lambda functions.

使用此选项,您需要了解以下内容:

By using this option you would need to be aware of the following:

  • 每次检索值都会降低性能,以减少在全局上下文中调用此函数,以便可以在两次调用之间重用.
  • 每个键/值都需要一个单独的参数.对于数据库,这意味着要么创建单个参数,要么将整个凭据集存储为JSON对象,并在检索到它后对其进行解码.

秘密管理器

使用此选项,服务中内置了很多管理功能,密钥可以包含字符串或单行JSON对象.SDK将处理这些值的检索,但是您必须意识到,就像SSM一样,您会受到性能的影响,因此您需要查看与参数存储类似的解决方案.与SSM参数存储相比,秘密管理器的最大优势在于它与其他AWS服务的集成,从而允许诸如秘密轮换之类的功能.

Using this option a lot of the management is built into the service, a secret can contain either a string or a single line JSON object. The SDK will handle the retrieval of these values but you must be aware just like SSM you will take a performance hit so you'll want to take a look at a similar solution as the parameter store. The biggest advantage to secrets manager over SSM parameter store is its integrations with other AWS services allowing features such as secret rotation.

但是,如果您不需要Secrets Manager的功能,则可能要花比实际所需更多的钱,这是这三者中最昂贵的选择.

However if you don't need the features of secrets manager you may be paying for more than you actually require, this is the most expensive option of all three.

这篇关于使用Lambda时的AWS System Manager参数存储vs Secrets Manager vs Lambda中的环境变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆