An Amazon ECS service enables you to run and maintain a specified number of instances of a task definition simultaneously in an Amazon ECS cluster. If any of your tasks should fail or stop for any reason, the Amazon ECS service scheduler launches another instance of your task definition to replace it in order to maintain the desired number of tasks in the service.
Go to your Visual Studio web application project -> right click on the project in Solutions Explorer and click
Publish Container to AWS...
Deployment Target as
Service on an ECS Cluster leaving everything else as it is and click
Next on the Launch Configuration screen:
dojo-cluster. This cluster was created the previous module.
Security Groupsdrop-down to select it.
Next on the Service Configuration screen:
Create Newservice. Name it
Number of Tasks.
Minimum Healthy Percentto 100 percent.
Nextbutton to go to the next page.
We are not configuring Application Load Balancer Configuration in this lab, you can skip this screen by clicking
Next on the Task Definition screen we want to create a newer revision of our existing task and container hence we will select our existing
With other settings as default, click
Please note that deployment process will take few minutes.
You can now review the objects created by the AWS Toolkit for Visual Studio wizard.
In AWS Explorer, click
Clusters, then open
dojo-cluster and go to
Services tab. You will see the service deployed by the wizard.
Desired tasksshould be 2.
Running tasksshould be 2.
Tasks Tab. You should see one Task from previous deployment and two new Tasks with
Task Group named
service:dojo-service. These two tasks are managed by service that wizard deployed.
If you notice, this is no different from ECS Task you created in previous module. So, what is the advantage of launching your task as a service?
Stop All button.
After few seconds, you would see 2 tasks launched automatically by ECS Service to meet desired count of 2 (100%) as we mentioned in task definition. Also please note that ECS Task from the previous module is not re-launched.
After few seconds both tasks will be up and running again:
So you can copy
Public IP and open it in a browser to verify that application is up and running as before:
If any of your tasks should fail or stop for any reason, the Amazon ECS service scheduler launches another instance of your task definition to replace it in order to maintain the desired number of tasks in the service. For applications that you want to run continuously, like web applications, using an ECS service is ideal.