Details
Scenario
I use the Serverless Framework to maintain an HTTP service in a shared AWS account (i.e. other apps/services exist on this company account, which are unrelated to mine).
The major AWS resources involved in my service are:
- API Gateway
- Lambda
- CloudWatch
- ElastiCache
- X-Ray
I am trying to determine the cost of my Serverless application by using AWS' Cost Explorer.
Given that in order to determine the cost of my service I need to filter out other services, I was looking for a way in which Serverless may delineate my deployed resources.
I discovered Serverless automatically applies the aws:cloudformation:stack-name
AWS tag based on the service
property specific in the serverless.yml
configuration file.
This allowed me, in cost explorer, to apply this value as a filter on the Tag
field.
Problem
The filtering worked as I expected, but only for a few of the services, namely Lambda and CloudWatch. API Gateway, ElastiCache, and X-Ray seem to be missing the aws:cloudformation:stack-name
tag entirely.
Question
How can I configure Serverless such that it properly applies the same aws:cloudformation:stack-name
tag to all my associated resources that it deploys?
Alternatively, if there is some limitation on this feature or my understanding of AWS tags is incorrect, what are the other routes I may take to achieve my task?
Serverless Framework Info
frameworkVersion
3
Installed Plugins
(These may be unrelated to my question, but I list them in case they are somehow relevant.)
serverless-domain-manager
serverless-offline
serverless-vpc-discovery
serverless-plugin-lambda-insights
Have you tried the
stackTags
property?Reference: https://mojitocoder.medium.com/aws-resources-tagging-using-serverless-framework-fbfb32122cde