AWS Security ChangesHomeSearch

AWS code-library documentation change

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

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

Summary

Updated ECS UpdateService examples to demonstrate changing desired task count and enabling Availability Zone rebalancing, including detailed output formats. Reorganized examples and updated CLI commands.

Security assessment

The changes focus on operational aspects of ECS service updates (task count adjustment, AZ rebalancing) and output formatting. No security vulnerabilities, mitigations, or security-specific features are mentioned. Network configurations shown in outputs (security groups, subnets) are part of standard service definitions rather than new security documentation.

Diff

diff --git a/code-library/latest/ug/ecs_example_ecs_UpdateService_section.md
index 089aa979d..be7675a48 100644
--- a/code-library/latest/ug/ecs_example_ecs_UpdateService_section.md
+++ b/code-library/latest/ug/ecs_example_ecs_UpdateService_section.md
@@ -17 +17 @@ CLI
-**Example 1: To change the task definition used in a service**
+**Example 1: To change the number of instantiations in a service**
@@ -19 +19 @@ CLI
-The following `update-service` example updates the `my-http-service` service to use the `amazon-ecs-sample` task definition.
+The following `update-service` example updates the desired task count of the service `my-http-service` to 2.
@@ -22 +22,4 @@ The following `update-service` example updates the `my-http-service` service to
-    aws ecs update-service --service my-http-service --task-definition amazon-ecs-sample
+    aws ecs update-service \
+       --cluster MyCluster
+       --service my-http-service \
+       --desired-count 2
@@ -25 +28 @@ The following `update-service` example updates the `my-http-service` service to
-**Example 2: To change the number of tasks in a service**
+Output:
@@ -27 +29,0 @@ The following `update-service` example updates the `my-http-service` service to
-The following `update-service` example updates the desired task count of the service `my-http-service` to 3.
@@ -28,0 +31,115 @@ The following `update-service` example updates the desired task count of the ser
+    {
+        "service": {
+            "serviceArn": "arn:aws:ecs:us-east-1:123456789012:service/MyCluster/my-http-service",
+            "serviceName": "my-http-service",
+            "clusterArn": "arn:aws:ecs:us-east-1:123456789012:cluster/MyCluster",
+            "loadBalancers": [],
+            "serviceRegistries": [],
+            "status": "ACTIVE",
+            "desiredCount": 2,
+            "runningCount": 1,
+            "pendingCount": 0,
+            "capacityProviderStrategy": [
+                {
+                    "capacityProvider": "FARGATE",
+                    "weight": 1,
+                    "base": 0
+                }
+            ],
+            "platformVersion": "LATEST",
+            "platformFamily": "Linux",
+            "taskDefinition": "arn:aws:ecs:us-east-1:123456789012:task-definition/MyTaskDefinition",
+            "deploymentConfiguration": {
+                "deploymentCircuitBreaker": {
+                    "enable": true,
+                    "rollback": true
+                },
+                "maximumPercent": 200,
+                "minimumHealthyPercent": 100,
+                "alarms": {
+                    "alarmNames": [],
+                    "rollback": false,
+                    "enable": false
+                }
+            },
+            "deployments": [
+                {
+                    "id": "ecs-svc/1976744184940610707",
+                    "status": "PRIMARY",
+                    "taskkDefinition": "arn:aws:ecs:us-east-1:123456789012:task-definition/MyTaskDefinition",
+                    "desiredCount": 1,
+                    "pendingCount": 0,
+                    "runningCount": 1,
+                    "failedTasks": 0,
+                    "createdAt": "2024-12-03T16:24:25.225000-05:00",
+                    "updatedAt": "2024-12-03T16:25:15.837000-05:00",
+                    "capacityProviderStrategy": [
+                        {
+                            "capacityProvider": "FARGATE",
+                            "weight": 1,
+                            "base": 0
+                        }
+                    ],
+                    "platformVersion": "1.4.0",
+                    "platformFamily": "Linux",
+                    "networkConfiguration": {
+                        "awsvpcConfiguration": {
+                            "subnets": [
+                                "subnet-0d0eab1bb38d5ca64",
+                                "subnet-0db5010045995c2d5"
+                            ],
+                            "securityGroups": [
+                                "sg-02556bf85a191f59a"
+                            ],
+                            "assignPublicIp": "ENABLED"
+                        }
+                    },
+                    "rolloutState": "COMPLETED",
+                    "rolloutStateReason": "ECS deployment ecs-svc/1976744184940610707 completed."
+                }
+            ],
+            "roleArn": "arn:aws:iam::123456789012:role/aws-service-role/ecs.amazonaws.com/AWSServiceRoleForECS",
+            "events": [
+                {
+                    "id": "f27350b9-4b2a-4e2e-b72e-a4b68380de45",
+                    "createdAt": "2024-12-30T13:24:07.345000-05:00",
+                    "message": "(service my-http-service) has reached a steady state."
+                },
+                {
+                    "id": "e764ec63-f53f-45e3-9af2-d99f922d2957",
+                    "createdAt": "2024-12-30T12:32:21.600000-05:00",
+                    "message": "(service my-http-service) has reached a steady state."
+                },
+                {
+                    "id": "28444756-c2fa-47f8-bd60-93a8e05f3991",
+                    "createdAt": "2024-12-08T19:26:10.367000-05:00",
+                    "message": "(service my-http-service) has reached a steady state."
+                }
+            ],
+            "createdAt": "2024-12-03T16:24:25.225000-05:00",
+            "placementConstraints": [],
+            "placementStrategy": [],
+            "networkConfiguration": {
+                "awsvpcConfiguration": {
+                    "subnets": [
+                        "subnet-0d0eab1bb38d5ca64",
+                        "subnet-0db5010045995c2d5"
+                    ],
+                    "securityGroups": [
+                        "sg-02556bf85a191f59a"
+                    ],
+                    "assignPublicIp": "ENABLED"
+                }
+            },
+            "healthCheckGracePeriodSeconds": 0,
+            "schedulingStrategy": "REPLICA",
+            "deploymentController": {
+                "type": "ECS"
+            },
+            "createdBy": "arn:aws:iam::123456789012:role/Admin",
+            "enableECSManagedTags": true,
+            "propagateTags": "NONE",
+            "enableExecuteCommand": false,
+            "availabilityZoneRebalancing": "ENABLED"
+        }
+    }
@@ -30 +147 @@ The following `update-service` example updates the desired task count of the ser
-    aws ecs update-service --service my-http-service --desired-count 3
+For more information, see [Updating an Amazon ECS service using the console](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/update-service-console-v2.html) in the _Amazon ECS Developer Guide_.
@@ -31,0 +149 @@ The following `update-service` example updates the desired task count of the ser
+**Example 2: To turn on Availability Zone rebalancing for a service**
@@ -33 +151,113 @@ The following `update-service` example updates the desired task count of the ser
-For more information, see [Updating a Service](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/update-service.html) in the _Amazon ECS Developer Guide_.
+The following `update-service` example turns on Availability Zone rebalancing for the service `my-http-service`.
+    
+    
+    aws ecs update-service \
+        --cluster MyCluster \
+        --service my-http-service \
+        --availability-zone-rebalancing ENABLED
+    
+
+Output:
+    
+    
+    {
+        "service": {
+            "serviceArn": "arn:aws:ecs:us-east-1:123456789012:service/MyCluster/my-http-service",
+            "serviceName": "my-http-service",
+            "clusterArn": "arn:aws:ecs:us-east-1:123456789012:cluster/MyCluster",
+            "loadBalancers": [],
+            "serviceRegistries": [],
+            "status": "ACTIVE",
+            "desiredCount": 2,
+            "runningCount": 1,
+            "pendingCount": 0,
+            "capacityProviderStrategy": [
+                {
+                    "capacityProvider": "FARGATE",
+                    "weight": 1,
+                    "base": 0
+                }
+            ],
+            "platformVersion": "LATEST",
+            "platformFamily": "Linux",
+            "taskDefinition": "arn:aws:ecs:us-east-1:123456789012:task-definition/MyTaskDefinition",
+            "deploymentConfiguration": {
+                "deploymentCircuitBreaker": {
+                    "enable": true,
+                    "rollback": true
+                },
+                "maximumPercent": 200,
+                "minimumHealthyPercent": 100,
+                "alarms": {
+                    "alarmNames": [],
+                    "rollback": false,
+                    "enable": false
+                }
+            },
+            "deployments": [
+                {
+                    "id": "ecs-svc/1976744184940610707",
+                    "status": "PRIMARY",
+                    "taskkDefinition": "arn:aws:ecs:us-east-1:123456789012:task-definition/MyTaskDefinition",
+                    "desiredCount": 1,
+                    "pendingCount": 0,
+                    "runningCount": 1,
+                    "failedTasks": 0,
+                    "createdAt": "2024-12-03T16:24:25.225000-05:00",