AWS Security ChangesHomeSearch

AWS code-library documentation change

Service: code-library · 2026-05-04 · Documentation low

File: code-library/latest/ug/bash_2_lambda_code_examples.md

Summary

Added resource tagging commands for IAM roles, Lambda functions, and CloudWatch Logs groups across multiple examples. Modified dashboard creation to use a variable for naming. Removed dashboard name extraction logic. Changed error handling flag in scripts.

Security assessment

The changes primarily add resource tagging for organizational purposes (project=doc-smith) and tutorial tracking. No security vulnerabilities, configurations, or features are addressed. The removal of '-e' in 'set -uo pipefail' alters error handling but doesn't directly relate to security. Tagging improvements don't constitute security documentation.

Diff

diff --git a/code-library/latest/ug/bash_2_lambda_code_examples.md b/code-library/latest/ug/bash_2_lambda_code_examples.md
index 8df5e72fd..e1b6424a2 100644
--- a//code-library/latest/ug/bash_2_lambda_code_examples.md
+++ b//code-library/latest/ug/bash_2_lambda_code_examples.md
@@ -181,0 +182,2 @@ There's more on GitHub. Find the complete example and learn how to set up and ru
+    aws iam tag-role --role-name "$ROLE_NAME" --tags Key=project,Value=doc-smith Key=tutorial,Value=apigateway-lambda-integration
+    
@@ -204 +206,2 @@ There's more on GitHub. Find the complete example and learn how to set up and ru
-        --environment "Variables={LOG_LEVEL=INFO}" || {
+        --environment "Variables={LOG_LEVEL=INFO}" \
+        --tags project=doc-smith,tutorial=apigateway-lambda-integration || {
@@ -215,0 +219 @@ There's more on GitHub. Find the complete example and learn how to set up and ru
+        --tags project=doc-smith,tutorial=apigateway-lambda-integration \
@@ -412 +416 @@ There's more on GitHub. Find the complete example and learn how to set up and ru
-    set -euo pipefail
+    set -uo pipefail
@@ -502,0 +507 @@ There's more on GitHub. Find the complete example and learn how to set up and ru
+            --tags Key=project,Value=doc-smith Key=tutorial,Value=cloudwatch-dynamicdash \
@@ -526,0 +532 @@ There's more on GitHub. Find the complete example and learn how to set up and ru
+            --tags project=doc-smith,tutorial=cloudwatch-dynamicdash \
@@ -647,0 +654 @@ There's more on GitHub. Find the complete example and learn how to set up and ru
+    DASHBOARD_NAME="LambdaMetricsDashboard-$(date +%s)"
@@ -649 +656 @@ There's more on GitHub. Find the complete example and learn how to set up and ru
-        --dashboard-name "LambdaMetricsDashboard-$(date +%s)" \
+        --dashboard-name "$DASHBOARD_NAME" \
@@ -672,3 +678,0 @@ There's more on GitHub. Find the complete example and learn how to set up and ru
-    # Extract dashboard name from result
-    DASHBOARD_NAME=$(echo "$DASHBOARD_RESULT" | grep -oP '"DashboardName"\s*:\s*"\K[^"]+' || echo "LambdaMetricsDashboard")
-    
@@ -1103,0 +1108,4 @@ There's more on GitHub. Find the complete example and learn how to set up and ru
+    aws iam tag-role \
+        --role-name "$ROLE_NAME" \
+        --tags Key=project,Value=doc-smith Key=tutorial,Value=lambda-gettingstarted
+    
@@ -1151,0 +1160 @@ There's more on GitHub. Find the complete example and learn how to set up and ru
+        --tags project=doc-smith,tutorial=lambda-gettingstarted \
@@ -1257,0 +1267,4 @@ There's more on GitHub. Find the complete example and learn how to set up and ru
+    aws logs tag-log-group \
+        --log-group-name "$LOG_GROUP_NAME" \
+        --tags project=doc-smith,tutorial=lambda-gettingstarted
+    
@@ -1491 +1504 @@ There's more on GitHub. Find the complete example and learn how to set up and ru
-    ROLE_OUTPUT=$(log_cmd "aws iam create-role --role-name '$ROLE_NAME' --assume-role-policy-document file://trust-policy.json --output json")
+    ROLE_OUTPUT=$(log_cmd "aws iam create-role --role-name '$ROLE_NAME' --assume-role-policy-document file://trust-policy.json --tags Key=project,Value=doc-smith Key=tutorial,Value=cloudwatch-streams --output json")
@@ -1545 +1558 @@ There's more on GitHub. Find the complete example and learn how to set up and ru
-    LAMBDA1_OUTPUT=$(log_cmd "aws lambda create-function --function-name '$LAMBDA_FUNCTION1' --runtime python3.11 --role '$ROLE_ARN' --handler lambda_function.handler --zip-file fileb://lambda_function.zip --timeout 30 --memory-size 128")
+    LAMBDA1_OUTPUT=$(log_cmd "aws lambda create-function --function-name '$LAMBDA_FUNCTION1' --runtime python3.11 --role '$ROLE_ARN' --handler lambda_function.handler --zip-file fileb://lambda_function.zip --timeout 30 --memory-size 128 --tags project=doc-smith,tutorial=cloudwatch-streams")
@@ -1550 +1563 @@ There's more on GitHub. Find the complete example and learn how to set up and ru
-    LAMBDA2_OUTPUT=$(log_cmd "aws lambda create-function --function-name '$LAMBDA_FUNCTION2' --runtime python3.11 --role '$ROLE_ARN' --handler lambda_function.handler --zip-file fileb://lambda_function.zip --timeout 30 --memory-size 128")
+    LAMBDA2_OUTPUT=$(log_cmd "aws lambda create-function --function-name '$LAMBDA_FUNCTION2' --runtime python3.11 --role '$ROLE_ARN' --handler lambda_function.handler --zip-file fileb://lambda_function.zip --timeout 30 --memory-size 128 --tags project=doc-smith,tutorial=cloudwatch-streams")