AWS code-library documentation change
Summary
Added resource tagging throughout ECS/EC2 examples including clusters, key pairs, security groups, IAM roles, instances, task definitions, and policies with project/tutorial tags
Security assessment
Changes exclusively implement resource tagging for organizational/tracking purposes. No security vulnerabilities are fixed, no security features are documented, and tagging doesn't alter resource security capabilities.
Diff
diff --git a/code-library/latest/ug/bash_2_ssm_code_examples.md b/code-library/latest/ug/bash_2_ssm_code_examples.md index 1ecbab99b..bd7d49a0a 100644 --- a//code-library/latest/ug/bash_2_ssm_code_examples.md +++ b//code-library/latest/ug/bash_2_ssm_code_examples.md @@ -66,0 +67,4 @@ There's more on GitHub. Find the complete example and learn how to set up and ru + # Tags + PROJECT_TAG="doc-smith" + TUTORIAL_TAG="ecs-ec2" + @@ -256 +260 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - CLUSTER_ARN=$(aws ecs create-cluster --cluster-name "$CLUSTER_NAME" --query 'cluster.clusterArn' --output text) + CLUSTER_ARN=$(aws ecs create-cluster --cluster-name "$CLUSTER_NAME" --tags key=project,value=$PROJECT_TAG key=tutorial,value=$TUTORIAL_TAG --query 'cluster.clusterArn' --output text) @@ -278,0 +283,2 @@ There's more on GitHub. Find the complete example and learn how to set up and ru + + aws ec2 create-tags --resources "$KEY_PAIR_NAME" --tags Key=project,Value=$PROJECT_TAG Key=tutorial,Value=$TUTORIAL_TAG 2>>"$LOG_FILE" || log "WARNING: Failed to tag key pair" @@ -288,0 +295 @@ There's more on GitHub. Find the complete example and learn how to set up and ru + --tag-specifications "ResourceType=security-group,Tags=[{Key=project,Value=$PROJECT_TAG},{Key=tutorial,Value=$TUTORIAL_TAG}]" \ @@ -360,0 +368,2 @@ There's more on GitHub. Find the complete example and learn how to set up and ru + aws iam tag-role --role-name ecsInstanceRole --tags Key=project,Value=$PROJECT_TAG Key=tutorial,Value=$TUTORIAL_TAG + @@ -412 +421 @@ 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=ecs-tutorial-instance}]" \ + --tag-specifications "ResourceType=instance,Tags=[{Key=Name,Value=ecs-tutorial-instance},{Key=project,Value=$PROJECT_TAG},{Key=tutorial,Value=$TUTORIAL_TAG}]" \ @@ -490 +499,11 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - "networkMode": "bridge" + "networkMode": "bridge", + "tags": [ + { + "key": "project", + "value": "PROJECT_TAG_PLACEHOLDER" + }, + { + "key": "tutorial", + "value": "TUTORIAL_TAG_PLACEHOLDER" + } + ] @@ -496,0 +516,2 @@ There's more on GitHub. Find the complete example and learn how to set up and ru + sed -i "s|PROJECT_TAG_PLACEHOLDER|$PROJECT_TAG|g" task-definition.json + sed -i "s|TUTORIAL_TAG_PLACEHOLDER|$TUTORIAL_TAG|g" task-definition.json @@ -530,0 +552 @@ There's more on GitHub. Find the complete example and learn how to set up and ru + --tags key=project,value=$PROJECT_TAG key=tutorial,value=$TUTORIAL_TAG \ @@ -911,0 +934 @@ There's more on GitHub. Find the complete example and learn how to set up and ru + --tag-specifications 'ResourceType=security-group,Tags=[{Key=project,Value=doc-smith},{Key=tutorial,Value=ec2-basics}]' \ @@ -980,0 +1004 @@ There's more on GitHub. Find the complete example and learn how to set up and ru + --tag-specifications 'ResourceType=instance,Tags=[{Key=project,Value=doc-smith},{Key=tutorial,Value=ec2-basics}]' 'ResourceType=volume,Tags=[{Key=project,Value=doc-smith},{Key=tutorial,Value=ec2-basics}]' \ @@ -1062,0 +1087 @@ There's more on GitHub. Find the complete example and learn how to set up and ru + --tag-specifications 'ResourceType=elastic-ip,Tags=[{Key=project,Value=doc-smith},{Key=tutorial,Value=ec2-basics}]' \ @@ -1592,0 +1617,2 @@ There's more on GitHub. Find the complete example and learn how to set up and ru + aws iam tag-policy --policy-arn "$POLICY_ARN" \ + --tags Key=project,Value=doc-smith Key=tutorial,Value=aws-systems-manager-gs @@ -1659,0 +1686,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-systems-manager-gs