Ensure Serverless Framework Function should have associated tags
Serverless Function is a resource type in AWS Serverless Application Model (AWS SAM) that creates an AWS Lambda function, an IAM execution role, and event source mappings that trigger the function.
Tags are a property of Serverless Function that allows you to add key-value pairs to your Lambda function for identification and management.
Tags can also be used to control access to your Lambda resources.
Some reasons why Serverless Functions should have associated tags are:
Group and filter your functions by project, environment, owner, or other criteria.
To track the cost and usage of your functions across different dimensions.
To apply IAM policies that grant or deny permissions based on tags.
Automate the deployment and configuration of your functions using AWS Systems Manager.
Risk Level: medium
Platform: AWS Serverless
Spectral Rule ID: SLFW006
REMEDIATION
Add tags inside the function or in the provider
service: example-service
frameworkVersion: '2'
provider:
name: aws
runtime: nodejs12.x
functions:
hello:
handler: handler.example
onError: arn:aws:sns:us-east-1:XXXXXX:example
+ tags:
+ foo: bar
OR
service: service
frameworkVersion: '2'
provider:
name: aws
runtime: nodejs12.x
+ stackTags:
+ foo: bar
Read more:
Updated over 1 year ago