AWS | Cleaning up your Amazon ECS resources


In my previous blog posts on AWS (Introduction to Amazon ECS | Launch Amazon ECS cluster | Scaling with Amazon ECS | Deploy updated Task definition/Docker image), I had given an overview about what is Amazon ECS with a walk-through on how to launch Amazon ECS and then deploy sample app by creating a task definition, scheduling tasks and configuring a cluster and to scale in / scale out the same on Amazon ECS and we have also gained the knowledge on how to create a new revision for the existing task definition to deploy the latest updated docker image.

In this we will have a look on cleaning up your Amazon ECS resources that we have created so far. Once you have launched the Amazon ECS cluster and try to terminate container instances in order to clean up the resources then you won’t be able to do so because of cloud formation.

Below are the step that you have to follow in order to clean up Amazon ECS recourses :

1. Scale Down Services :  Firstly, we have to scale down the desired count of tasks to ‘0’ of all the services running in a cluster, so that Amazon ECS does not try to start new tasks on our container instances while we are cleaning up.

1-copy

1.png

2. Delete Services : Then we must delete the same services inside that cluster. After our service has scaled down to ‘0’ task, we can delete it. But if you try to delete the service before scaling it down to ‘0’ then Amazon ECS won’t let you do so.

2

3. De-register Task Definitions : Under Task definition navigation pane, select all the revision of a definition that you want to clean up and click on De-register.

3

4. De-register Container Instances : Before we can delete a cluster, we must De-register the container instances inside that cluster. For each container instance inside our cluster, follow the procedures in De-register a Container Instance to De-register it.

4

5.png

5. Delete a Cluster : Finally, we have removed the active resources from our Amazon ECS cluster, then go to Clusters navigation pane and delete the cluster by clicking on ‘Delete cluster’ button.

6.png

7

This will clean up your cluster recourses.

I hope through these series of blog, you will be able to launch Amazon ECS cluster and deploy your application in container environment and easily able to scale in/ scale out the tasks and container instances.

If you have any question/concerns, please feel free to ask. I’ll be more than happy to help you. 🙂

Thanks


KNOLDUS-advt-sticker

This entry was posted in Amazon, Amazon EC2, AWS, AWS Services, Scala and tagged , , , , . Bookmark the permalink.

4 Responses to AWS | Cleaning up your Amazon ECS resources

  1. Pingback: AWS | Cleaning up your Amazon ECS resources – prashantgoel6

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s