简体   繁体   English

Python 数据摄取(从对 AWS S3 存储桶的 API 调用“获取”开始),如何管理用户名/密码/API 密钥和令牌(在短时间窗口内过期)

[英]Python Data Ingestion (Start with API call "Get" to AWS S3 Bucket), how to manage the username/pwd/api-key and token( expired in short time window)

data source is from SaaS Server's API endpoints, aim to use python to move data into AWS S3 Bucket(Python's Boto3 lib) API is assigned via authorized Username/password combination and unique api-key.数据源来自 SaaS Server 的 API 端点,旨在使用 python 将数据移动到 AWS S3 Bucket(Python 的 Boto3 lib)API 通过授权的用户名/密码组合和唯一的 api-key 分配。 then every time initially call API need get Token for further info fetch.然后每次最初调用 API 时都需要获取令牌以获取进一步的信息。

have 2 question:有2个问题:

  1. how to manage those secrets above, save to a head file (*.ini, *.json *.yaml) or saved via AWS's Secret-Manager?如何管理上面的这些秘密,保存到头文件(*.ini、*.json *.yaml)或通过 AWS 的 Secret-Manager 保存?
  2. the Token is a bit challenging, the basically way is each Endpoint, fetch a new token and do the API call then that's end of too many pipeline (like if 100 Endpoints info need per downstream business needs) then need to craft 100 pipeline like an universal template repeating 100 times.令牌有点挑战,基本上的方法是每个端点,获取一个新令牌并执行 API 调用然后这是太多管道的末端(比如如果每个下游业务需要 100 个端点信息)然后需要制作 100 个管道就像通用模板重复 100 次。

I am new to Python programing world, you all feel free to comment to share any user-case.我是 Python 编程世界的新手,大家可以随时发表评论以分享任何用户案例。 Much appreciate !!非常感谢 !!

I searched and read this show-case我搜索并阅读了这个展示案例

[saving-from-api-to-s3-bucket/74648533] saving from api to s3 bucket [saving-from-api-to-s3-bucket/74648533] 从 api 保存到 s3 桶

and "how-to-write-a-file-or-data-to-an-s3-object-using-boto3" How to write a file or data to an S3 object using boto3和“如何使用 boto3 将文件或数据写入 s3 对象” 如何使用 boto3 将文件或数据写入 S3 对象

I found this has been helpful:我发现这很有帮助:

  • # Python-decopule summary: store parameters in.ini or.env files; # Python-decopule总结:将参数存放在.ini 或.env 文件中;

  • # few options of manage(hiding) sensitive info # 管理(隐藏)敏感信息的几个选项

     a. IAM role b. Store Secrets using **Parameter Store** c. Store Secrets using **Secrets Manager** - Current method recommended by AWS

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

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