AWS code-library documentation change
Summary
Modified script error handling and added resource tagging
Security assessment
The 'set -e' removal changes error handling behavior but doesn't address any specific security vulnerability. Tagging additions are for resource organization only, with no security context.
Diff
diff --git a/code-library/latest/ug/bash_2_cloudwatch_code_examples.md b/code-library/latest/ug/bash_2_cloudwatch_code_examples.md index 5aa77484c..60e754cca 100644 --- a//code-library/latest/ug/bash_2_cloudwatch_code_examples.md +++ b//code-library/latest/ug/bash_2_cloudwatch_code_examples.md @@ -62 +62 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - set -euo pipefail + set -uo pipefail @@ -152,0 +153 @@ 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 \ @@ -176,0 +178 @@ There's more on GitHub. Find the complete example and learn how to set up and ru + --tags project=doc-smith,tutorial=cloudwatch-dynamicdash \ @@ -297,0 +300 @@ There's more on GitHub. Find the complete example and learn how to set up and ru + DASHBOARD_NAME="LambdaMetricsDashboard-$(date +%s)" @@ -299 +302 @@ 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" \ @@ -322,3 +324,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") - @@ -607,0 +608 @@ There's more on GitHub. Find the complete example and learn how to set up and ru + aws iam tag-role --role-name "$FIS_ROLE_NAME" --tags Key=project,Value=doc-smith Key=tutorial,Value=aws-fault-injection-service-gs @@ -659,0 +661 @@ There's more on GitHub. Find the complete example and learn how to set up and ru + aws iam tag-role --role-name "$EC2_ROLE_NAME" --tags Key=project,Value=doc-smith Key=tutorial,Value=aws-fault-injection-service-gs @@ -705 +707 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=FIS-Test-Instance}]') + --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=FIS-Test-Instance},{Key=project,Value=doc-smith},{Key=tutorial,Value=aws-fault-injection-service-gs}]') @@ -841 +843,3 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - "Name": "FIS-CPU-Stress-Experiment" + "Name": "FIS-CPU-Stress-Experiment", + "project": "doc-smith", + "tutorial": "aws-fault-injection-service-gs" @@ -1289 +1293 @@ 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") @@ -1343 +1347 @@ 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") @@ -1348 +1352 @@ 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")