AWS Security ChangesHomeSearch

AWS code-library documentation change

Service: code-library · 2025-03-19 · Documentation low

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

Summary

Multiple documentation updates including syntax corrections, example restructuring, removal of EBS volume configuration examples, and link updates

Security assessment

Changes involve documentation formatting, example reorganization, and removal of EBS volume configuration examples. No evidence of addressing security vulnerabilities or adding new security guidance. Removed EBS examples were configuration demonstrations rather than security fixes.

Diff

diff --git a/code-library/latest/ug/cli_2_ecs_code_examples.md b/code-library/latest/ug/cli_2_ecs_code_examples.md
index b59058c94..238f1142e 100644
--- a/code-library/latest/ug/cli_2_ecs_code_examples.md
+++ b/code-library/latest/ug/cli_2_ecs_code_examples.md
@@ -300 +300 @@ The following `create-service` example shows how to create a service using a Far
-        --network-configuration 'awsvpcConfiguration={subnets=[subnet-12344321],securityGroups=[sg-12344321],assignPublicIp=ENABLED}' \
+        --network-configuration "awsvpcConfiguration={subnets=[subnet-12344321],securityGroups=[sg-12344321],assignPublicIp=ENABLED}" \
@@ -386,2 +385,0 @@ Output:
-For more information, see [Creating a Service](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/create-service-console-v2.html) in the _Amazon ECS Developer Guide_.
-
@@ -443,2 +440,0 @@ Output:
-For more information, see [Creating a Service](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/create-service-console-v2.html) in the _Amazon ECS Developer Guide_.
-
@@ -492,2 +487,0 @@ Output:
-For more information, see [Creating a Service](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/create-service-console-v2.html) in the _Amazon ECS Developer Guide_.
-
@@ -496,10 +490 @@ For more information, see [Creating a Service](https://docs.aws.amazon.com/Amazo
-The following `create-service` example shows how to create a service that is behind a load balancer. You must have a load balancer configured in the same Region as your container instance. This example uses the `--cli-input-json` option and a JSON input file called `ecs-simple-service-elb.json` with the following content.
-    
-    
-    aws ecs create-service \
-        --cluster MyCluster \
-        --service-name ecs-simple-service-elb \
-        --cli-input-json file://ecs-simple-service-elb.json
-    
-
-Contents of `ecs-simple-service-elb.json`:
+The following `create-service` example shows how to create a service that is behind a load balancer. You must have a load balancer configured in the same Region as your container instance. This example uses the `--cli-input-json` option and a JSON input file called `ecs-simple-service-elb.json` with the following content:
@@ -521,0 +507,9 @@ Contents of `ecs-simple-service-elb.json`:
+Command:
+    
+    
+    aws ecs create-service \
+        --cluster MyCluster \
+        --service-name ecs-simple-service-elb \
+        --cli-input-json file://ecs-simple-service-elb.json
+    
+
@@ -540 +534 @@ Output:
-            "clusterArn": "arn:aws:ecs:us-west-2:123456789012:cluster/MyCluster",
+            "clusterArn": "arn:aws:ecs:<us-west-2:123456789012:cluster/MyCluster",
@@ -559,136 +553 @@ Output:
-For more information, see [Use load balancing to distribute Amazon ECS service traffic](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-load-balancing.html) in the _Amazon ECS Developer Guide_.
-
-**Example 5: To configure Amazon EBS volumes at service creation**
-
-The following `create-service` example shows how to configure Amazon EBS volumes for each task managed by the service. You must have an Amazon ECS infrastructure role configured with the `AmazonECSInfrastructureRolePolicyForVolumes` managed policy attached. You must specify a task definition with the same volume name as in the `create-service` request. This example uses the `--cli-input-json` option and a JSON input file called `ecs-simple-service-ebs.json` with the following content.
-    
-    
-    aws ecs create-service \
-        --cli-input-json file://ecs-simple-service-ebs.json
-    
-
-Contents of `ecs-simple-service-ebs.json`:
-    
-    
-    {
-        "cluster": "mycluster",
-        "taskDefinition": "mytaskdef",
-        "serviceName": "ecs-simple-service-ebs",
-        "desiredCount": 2,
-        "launchType": "FARGATE",
-        "networkConfiguration":{
-            "awsvpcConfiguration":{
-                "assignPublicIp": "ENABLED",
-                "securityGroups": ["sg-12344321"],
-                "subnets":["subnet-12344321"]
-            }
-        },
-        "volumeConfigurations": [
-            {
-                "name": "myEbsVolume",
-                "managedEBSVolume": {
-                    "roleArn":"arn:aws:iam::123456789012:role/ecsInfrastructureRole",
-                    "volumeType": "gp3",
-                    "sizeInGiB": 100,
-                    "iops": 3000,
-                    "throughput": 125,
-                    "filesystemType": "ext4"
-                }
-            }
-       ]
-    }
-
-Output:
-    
-    
-    {
-        "service": {
-            "serviceArn": "arn:aws:ecs:us-west-2:123456789012:service/mycluster/ecs-simple-service-ebs",
-            "serviceName": "ecs-simple-service-ebs",
-            "clusterArn": "arn:aws:ecs:us-west-2:123456789012:cluster/mycluster",
-            "loadBalancers": [],
-            "serviceRegistries": [],
-            "status": "ACTIVE",
-            "desiredCount": 2,
-            "runningCount": 0,
-            "pendingCount": 0,
-            "launchType": "EC2",
-            "taskDefinition": "arn:aws:ecs:us-west-2:123456789012:task-definition/mytaskdef:3",
-            "deploymentConfiguration": {
-                "deploymentCircuitBreaker": {
-                    "enable": false,
-                    "rollback": false
-                },
-                "maximumPercent": 200,
-                "minimumHealthyPercent": 100
-            },
-            "deployments": [
-                {
-                    "id": "ecs-svc/7851020056849183687",
-                    "status": "PRIMARY",
-                    "taskDefinition": "arn:aws:ecs:us-west-2:123456789012:task-definition/mytaskdef:3",
-                    "desiredCount": 0,
-                    "pendingCount": 0,
-                    "runningCount": 0,
-                    "failedTasks": 0,
-                    "createdAt": "2025-01-21T11:32:38.034000-06:00",
-                    "updatedAt": "2025-01-21T11:32:38.034000-06:00",
-                    "launchType": "EC2",
-                    "networkConfiguration": {
-                        "awsvpcConfiguration": {
-                            "subnets": [
-                                "subnet-12344321"
-                            ],
-                            "securityGroups": [
-                                "sg-12344321"
-                            ],
-                            "assignPublicIp": "DISABLED"
-                        }
-                    },
-                    "rolloutState": "IN_PROGRESS",
-                    "rolloutStateReason": "ECS deployment ecs-svc/7851020056849183687 in progress.",
-                    "volumeConfigurations": [
-                        {
-                            "name": "myEBSVolume",
-                            "managedEBSVolume": {
-                                "volumeType": "gp3",
-                                "sizeInGiB": 100,
-                                "iops": 3000,
-                                "throughput": 125,
-                                "roleArn": "arn:aws:iam::123456789012:role/ecsInfrastructureRole",
-                                "filesystemType": "ext4"
-                            }
-                        }
-                    ]
-                }
-            ],
-            "roleArn": "arn:aws:iam::123456789012:role/aws-service-role/ecs.amazonaws.com/AWSServiceRoleForECS",
-            "events": [],
-            "createdAt": "2025-01-21T11:32:38.034000-06:00",
-            "placementConstraints": [],
-            "placementStrategy": [],
-            "networkConfiguration": {
-                "awsvpcConfiguration": {
-                    "subnets": [
-                        "subnet-12344321"
-                    ],
-                    "securityGroups": [
-                        "sg-12344321"
-                    ],
-                    "assignPublicIp": "DISABLED"
-                }
-            },
-            "healthCheckGracePeriodSeconds": 0,
-            "schedulingStrategy": "REPLICA",
-            "deploymentController": {
-                "type": "ECS"
-            },
-            "createdBy": "arn:aws:iam::123456789012:user/AIDACKCEVSQ6C2EXAMPLE",
-            "enableECSManagedTags": false,
-            "propagateTags": "NONE",
-            "enableExecuteCommand": false,
-            "availabilityZoneRebalancing": "DISABLED"
-        }
-    }
-
-For more information, see [Use Amazon EBS volumes with Amazon ECS](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ebs-volumes.html) in the _Amazon ECS Developer Guide_.
+For more information, see [Creating a Service](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/create-service.html) in the _Amazon ECS Developer Guide_.
@@ -3334 +3193 @@ The following code example shows how to use `run-task`.
-**Example 1: To run a task on your default cluster**
+**To run a task on your default cluster**
@@ -3399,130 +3258 @@ Output:
-For more information, see [Running an application as a standalone task](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/standalone-task-create.html) in the _Amazon ECS Developer Guide_.
-
-**Example 2: To configure an Amazon EBS volume for a standalone task**
-
-The following `run-task` example configures an encrypted Amazon EBS volume for a Fargate task on the default cluster. You must have an Amazon ECS infrastructure role configured with the `AmazonECSInfrastructureRolePolicyForVolumes` managed policy attached. You must specify a task definition with the same volume name as in the `run-task` request. This example uses the `--cli-input-json` option and a JSON input file called `ebs.json`.
-    
-    
-    aws ecs run-task \
-        --cli-input-json file://ebs.json
-    
-
-Contents of `ebs.json`:
-    
-    
-    {
-       "cluster": "default",
-       "taskDefinition": "mytaskdef",