请问HN:关于AWS CDK和无服务器架构的设置建议
我正在和另一位“高级/员工”开发者做兼职工作,他厌倦了用 Node.js 编写大量代码,决定专注于 AWS 及其提供的各种工具。他的新技术栈如下:
- DynamoDB
- Node.js Lambda 函数
- S3
- CDK 用于设置基础设施,将 Lambda 附加到各种资源
我们几乎所有的功能都依赖于以下“通用/可重用”的现有代码。这些代码经过充分测试,因为它们在多个项目中被重用。
- 我们有一套核心的基础设施/Lambda 代码,执行一些常见的任务,比如:
- 授权/认证/账户管理 - 背后使用 Auth0 进行用户管理
- 计费 - 使用 Stripe 设置。我们有 DynamoDB 表、Webhook 和各种 Lambda 来支持基于上述账户的计费
- 管理上传 - 预签名和直接的多部分/表单数据上传,并在 DynamoDB 中保存元数据
- 创建和跟踪作业 - 通过 SQS
- 有一个作为服务的 API 模块,帮助我们跟踪销售给公众的 API 的使用情况
对于一个典型项目,我们会启动上述现有基础设施,并添加特定于项目的自定义基础设施。这通常涉及:
- 添加 API 网关并附加 Lambda 处理程序
- 其他相关操作。
我的问题是:
你们中有谁做过类似的事情?你们是如何组织可重用代码的?你们是否创建了自己的自定义构造库?你们是有一个巨大的网关来连接自定义 API,还是创建新的网关来处理各种需求?
查看原文
I'm doing this part time work with another "senior/staff" developer who got tired of writing lots of code
with nodejs and decided the way to go was doubling down on aws - and the various tools provided. His new stack
is as follows<p>- dynamodb
- nodejs lambda functions
- s3
- cdk to setup infra, attach lambda's to various resources<p>nearly all our features rely on the following "common/reuseable" existing code. This is
thoroughly tested because they are reused in multiple projects.
-> we have a core set of infra/lambda code that does common things like
-> authorization/authentication/accounts - using auth0 behind the scenes - for user management
-> billing - using a stripe setup. we have ddb table, webhooks and various lambda to support billing based on accounts above
-> managing uploads - presigned and direct multipart/form-data uploads and saving metadata in dd
-> creating and tracking jobs - via sqs
-> have api as a service module that helps us track useage for api's being sold to public<p>For a typical project, we spin up the above existing infra
Add custom infrastructure to do things specific to the project
This typically involves
-> adding an api gateway and attaching lambda handlers
-> and so on.<p>My question is
Which of you do something similar
How do you organize reuseable code - do you create your own custom constructs library?
Do you have one giant gateway that custom apis get attached to or
you create new gateways to do whatever.