AWS code-library documentation change
Summary
Updated CLI command syntax (single to double quotes), removed redundant documentation links, reorganized load balancer example structure, fixed ARN formatting typo, and removed Example 5 about EBS volume configuration.
Security assessment
Changes are primarily structural/formatting improvements. The removed EBS example contained security-related configurations (IAM roles), but its deletion does not indicate a security fix. No evidence of addressing vulnerabilities or adding new security documentation.
Diff
diff --git a/code-library/latest/ug/ecs_example_ecs_CreateService_section.md b/code-library/latest/ug/ecs_example_ecs_CreateService_section.md index 1d68c9312..31db73749 100644 --- a/code-library/latest/ug/ecs_example_ecs_CreateService_section.md +++ b/code-library/latest/ug/ecs_example_ecs_CreateService_section.md @@ -29 +29 @@ 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}" \ @@ -115,2 +114,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_. - @@ -172,2 +169,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_. - @@ -221,2 +216,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_. - @@ -225,10 +219 @@ 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: @@ -250,0 +236,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 + + @@ -269 +263 @@ Output: - "clusterArn": "arn:aws:ecs:us-west-2:123456789012:cluster/MyCluster", + "clusterArn": "arn:aws:ecs:<us-west-2:123456789012:cluster/MyCluster", @@ -288,136 +282 @@ 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_.