Python AWS Lambda 证书

标签 python python-3.x amazon-web-services aws-lambda ssl-certificate

如何向我的 Python3 AWS Lambda 函数使用的信任存储添加额外的 CA(证书颁发机构)?

最佳答案

如果您只需要一个 CA,则获取您的 crt 文件并在 Linux 中使用以下命令将其编码为 pem:

openssl x509 -text -in "{your CA}.crt" > cacert.pem

如果您需要将 CA 添加到默认 CA bundle ,请将 python3.8/site-packages/certifi/cacert.pem 复制到您的 lambda 文件夹。然后为每个 crt 运行此命令:

openssl x509 -text -in "{your CA}.crt" >> cacert.pem

创建 pem 文件后,部署 lambda,并将 REQUESTS_CA_BUNDLE 环境变量设置为 /var/task/cacert.pem

/var/task 是 AWS Lambda 将压缩后的代码提取到的位置。

关于Python AWS Lambda 证书,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56225178/

相关文章:

python - 确定 (*,G) 是否形成群论中的结合群

具有 2 个 gtk 窗口的 python 多处理

python - Seaborn 直方图使列变白

python - future 警告 : Using a non-tuple sequence for multidimensional indexing is deprecated use `arr[tuple(seq)]` instead of `arr[seq]`

amazon-web-services - 如何使用变量作为 terraform 提供者别名?

javascript - 如何在 Amazon Athena 上查询(搜索)具有 JSON 值的 sql?

python - 查找 ProtoBuf 的 Python DESCRIPTOR 中列出的枚举

python - 有什么方法可以从图像中提取变形的矩形/正方形?

python - 错误 : gunicorn: Failed to find application object 'app' in 'app'

amazon-web-services - 用于将数据从 ec2 迁移到 rds 的 cloudformation 模板