AWS code-library documentation change
Summary
Added resource tagging commands for SNS topics, subscriptions, IAM roles, IoT audit tasks, mitigation actions, S3 buckets, and AWS Config resources with project/tutorial tags
Security assessment
Changes only add resource tagging for organizational purposes. No security vulnerabilities are addressed, no security features are documented, and tagging doesn't impact resource security posture.
Diff
diff --git a/code-library/latest/ug/bash_2_sns_code_examples.md b/code-library/latest/ug/bash_2_sns_code_examples.md index acb5fba21..6f3d20b82 100644 --- a//code-library/latest/ug/bash_2_sns_code_examples.md +++ b//code-library/latest/ug/bash_2_sns_code_examples.md @@ -129 +129 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - # Step 1: Create an SNS topic with cost optimization: no tags + # Step 1: Create an SNS topic @@ -131 +131,5 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - TOPIC_RESULT=$(aws sns create-topic --name "$TOPIC_NAME" --region "$AWS_REGION" --output json) || handle_error "Failed to create SNS topic" + TOPIC_RESULT=$(aws sns create-topic \ + --name "$TOPIC_NAME" \ + --region "$AWS_REGION" \ + --tags Key=project,Value=doc-smith Key=tutorial,Value=amazon-simple-notification-service-gs \ + --output json) || handle_error "Failed to create SNS topic" @@ -173,0 +178,8 @@ There's more on GitHub. Find the complete example and learn how to set up and ru + # Tag the subscription + if [ "$SUBSCRIPTION_ARN" != "PendingConfirmation" ] && [ "$SUBSCRIPTION_ARN" != "pending confirmation" ]; then + aws sns tag-resource \ + --resource-arn "$SUBSCRIPTION_ARN" \ + --tags Key=project,Value=doc-smith Key=tutorial,Value=amazon-simple-notification-service-gs \ + --region "$AWS_REGION" 2>/dev/null || echo "Warning: Failed to tag subscription" + fi + @@ -402,0 +415,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=aws-iot-device-defender-gs 2>&1 || true + @@ -665,0 +680,3 @@ There's more on GitHub. Find the complete example and learn how to set up and ru + # Tag the audit task via IoT service + aws iot tag-resource --resource-arn "arn:aws:iot:$(aws configure get region):${ACCOUNT_ID}:audittask/${TASK_ID}" --tags Key=project,Value=doc-smith Key=tutorial,Value=aws-iot-device-defender-gs 2>&1 || true + @@ -774,0 +792 @@ There's more on GitHub. Find the complete example and learn how to set up and ru + aws iot tag-resource --resource-arn "$MITIGATION_ACTION_ARN" --tags Key=project,Value=doc-smith Key=tutorial,Value=aws-iot-device-defender-gs 2>&1 || true @@ -854 +872 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - SNS_RESULT=$(aws sns create-topic --name "IoTDDNotifications" --output json 2>&1) || true + SNS_RESULT=$(aws sns create-topic --name "IoTDDNotifications" --tags Key=project,Value=doc-smith Key=tutorial,Value=aws-iot-device-defender-gs --output json 2>&1) || true @@ -1297,0 +1316,3 @@ There's more on GitHub. Find the complete example and learn how to set up and ru + + aws s3api put-bucket-tagging --bucket "$S3_BUCKET_NAME" --tagging 'TagSet=[{Key=project,Value=doc-smith},{Key=tutorial,Value=aws-config-gs}]' + echo "Tags applied to S3 bucket" @@ -1311 +1332 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - SNS_RESULT=$(aws sns create-topic --name "$TOPIC_NAME") + SNS_RESULT=$(aws sns create-topic --name "$TOPIC_NAME" --tags Key=project,Value=doc-smith Key=tutorial,Value=aws-config-gs) @@ -1342,0 +1364,3 @@ 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=aws-config-gs + echo "Tags applied to IAM role" + @@ -1431,0 +1456,5 @@ There's more on GitHub. Find the complete example and learn how to set up and ru + if [ "$CREATED_NEW_CONFIG_RECORDER" = "true" ]; then + aws configservice tag-resource --resource-arn "arn:aws:config:${AWS_REGION}:${ACCOUNT_ID}:config-recorder/${CONFIG_RECORDER_NAME}" --tags Key=project,Value=doc-smith Key=tutorial,Value=aws-config-gs + echo "Tags applied to configuration recorder" + fi + @@ -1480,0 +1510,3 @@ There's more on GitHub. Find the complete example and learn how to set up and ru + + aws configservice tag-resource --resource-arn "arn:aws:config:${AWS_REGION}:${ACCOUNT_ID}:delivery-channel/${DELIVERY_CHANNEL_NAME}" --tags Key=project,Value=doc-smith Key=tutorial,Value=aws-config-gs + echo "Tags applied to delivery channel"