add_tag_on_serverless
原因
- 為了要細分 AWS cost 用到那部分,常見的方式為使用 Tag 來區分
做法
- 在 serverless.conf 中的 provider block 加 stackTags , 可以標註 tag
1
2
3
4
5provider:
stackTags:
owner: owner
env: ${self:custom.stage}
service: service
可以加強的部分
- 因為 stack tag,會有些 AWS resources 沒有加到 tag, 可以用 “Serverless Repository apps” 來加強
- lumigo-io/SAR-Propagate-CFN-Tags
- SAR app to propagate CloudFormation’s stack tags to resources that are currently not propagated automatically - e.g. CloudWatch Logs
Reference
- Top 10 Serverless best practices
- Serverless.yml Reference
- Here is a list of all available properties in serverless.yml when the provider is set to aws.