DEV Community

Nelson Hernández
Nelson Hernández

Posted on


How to update ECS Cluster automatically to new version task definition

ECS is the Amazon Elastic Container Service, which allows you to run and manage Docker containers in the cloud. An ECS cluster is a group of EC2 instances that are running the ECS service and are used to host your Docker containers.

To update the version of a task definition in an ECS cluster, you can use the update-service command in the AWS CLI. This command allows you to specify a new task definition for a service and deploy it to your ECS cluster. For example, to update the task definition for a service named my-service with a new task definition named my-new-task-definition, you can use the following command:

aws ecs update-service --cluster my-cluster --service my-service --task-definition my-new-task-definition --force-new-deployment

Enter fullscreen mode Exit fullscreen mode

This will update the task definition for the my-service service in the my-cluster cluster to use the my-new-task-definition task definition. The new task definition will be automatically deployed to the cluster, and the service will be updated to use the new task definition.

You can also specify additional options with the update-service command, such as the number of tasks to run for the service, or the deployment configuration for the service. For more information about the update-service command and all of its available options, see the AWS CLI documentation for ECS.

Top comments (0)

Timeless DEV post...

Git Concepts I Wish I Knew Years Ago

The most used technology by developers is not Javascript.

It's not Python or HTML.

It hardly even gets mentioned in interviews or listed as a pre-requisite for jobs.

I'm talking about Git and version control of course.

One does not simply learn git