More Info:
You can tag Lambda functions to organize them by owner, project or department. Tags are freeform key-value pairs that are supported across AWS services for use in filtering resources and adding detail to billing reports.Risk Level
InformationalAddress
Cost, Operational MaturityCompliance Standards
CBPTriage and Remediation
- Remediation
Remediation
Using Console
Using Console
Sure, here are the step by step instructions to remediate the “Lambda Functions Should Have Tags” misconfiguration in AWS using AWS console:
- Login to your AWS console.
- Navigate to the AWS Lambda service.
- Click on the checkbox next to the Lambda function that you want to remediate.
- Click on the “Add/Edit Tags” button at the top of the page.
- In the “Key” field, enter a tag key (e.g. “Environment”) that describes the function’s purpose or environment.
- In the “Value” field, enter a tag value (e.g. “Production”) that provides additional information about the function.
- Click on the “Add” button to add the tag to the function.
- Repeat steps 5-7 for any additional tags that you want to add.
- Once you have added all necessary tags, click on the “Save” button to save the changes.
Using CLI
Using CLI
To remediate the misconfiguration “Lambda Functions Should Have Tags” for AWS using AWS CLI, follow these steps:
- Open the AWS CLI on your local machine.
-
Use the following command to list all the Lambda functions in your AWS account:
- Identify the Lambda functions that do not have tags associated with them.
-
Use the following command to add tags to a Lambda function:
Replace
<region>with the AWS region where the Lambda function is located,<account-id>with your AWS account ID,<function-name>with the name of the Lambda function that needs to be tagged,<tag-key>with the name of the tag you want to add, and<tag-value>with the value of the tag you want to add. For example:This command will add a tag to the Lambda function named “my-function” with the key “Environment” and the value “Production”. - Repeat step 4 for all the Lambda functions that do not have tags associated with them.
-
Verify that all the Lambda functions have tags associated with them by using the following command:
Replace
<region>,<account-id>, and<function-name>with the appropriate values. This command will list all the tags associated with the Lambda function. If the Lambda function has tags associated with it, the output will show the tags. If the Lambda function does not have tags associated with it, the output will be empty. - Once you have verified that all the Lambda functions have tags associated with them, the remediation is complete.
Using Python
Using Python
To remediate the misconfiguration “Lambda Functions Should Have Tags” in AWS using Python, you can follow these steps:Note: You will need to have appropriate AWS credentials configured for Boto3 to be able to access your AWS account.
- First, import the necessary AWS SDK for Python (Boto3) library:
- Then, create a Boto3 client for AWS Lambda:
- Next, use the
list_functions()method to get a list of all Lambda functions in your account:
- Loop through each Lambda function and check if it has any tags. If not, add a tag with a key-value pair of your choice (e.g. “Environment”: “Production”):
- Finally, run the Python script and verify that all Lambda functions now have tags:

