AWS – Serverless解决方案
- 使用cognito 做身份验证,然后得到授权使用API,然后trigger lambda往dynamoDB进行数据调用

2. 使用cognito生成一个暂时的STS Token以便暂时访问S3的文件

3. 结合以上两种架构,以下的图片就添加了DAX为DynamoDB减轻了读取的压力,而且也能够在API Gateway当中做response的缓存(能够自定义TTL)

【需求1】

解答:根据以下的两张结构图当中,为了达到这个需求
- S3 设置了bucket policy 只能允许CloudFront 访问 (OAC)
- CloudFront能够全球缓存静态文件 (CDN)
- 对于dynamic的REST API就访问API Gateway,然后触发DynamoDB的读写
- 在DynamoDB前面添加DAX缓存层,以减缓DynamoDB的负载
- 当new user的数据写入DynamoDB当中就触发了DynamoDB Stream
- DynamoDB Stream就会调用lambda使用SES向用户发送welcome email
- 为了让上传的图片生成thumbnail,可以开启S3 Transfer Accelerator以便全球加速上传到某个region的bucket当中
- 当S3收到上传的图片之后就会触发lambda去生成thumbnail,然后把新生成的thumbnail再出入S3内,接着可以触发SQS或SNS
- 如果是非常需要全球架构的话,DynamoDB可以开启GlobalTable, 和Lambda可以使用Lambda@Edge


【需求2】微服务架构
- 可以自定义弹性使用想要的架构
- 每个服务可以互相访问获取数据,都是decoupling的结构
- Service1是典型的serverless 容器服务的架构
- Service2是典型的serverless代码的服务架构
- Service3是典型的EC2弹性扩张的服务架构

Facebook评论