DZone
Cloud Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Cloud Zone > Cleaning Up Your Amazon ECS Resources

Cleaning Up Your Amazon ECS Resources

Of course, if you're not using your ECS resources, it's time to clean them up. Scale them down, delete the services, then deregister them from AWS.

Prashant Goel user avatar by
Prashant Goel
·
Jan. 17, 17 · Cloud Zone · Tutorial
Like (2)
Save
Tweet
6.28K Views

Join the DZone community and get the full member experience.

Join For Free

In my previous blog posts on AWS (Introduction to Amazon ECS | Launch Amazon ECS cluster | Scaling With Amazon ECS | Deploying Updated Task Definitions/Docker images), I gave an overview on Amazon ECS with a walkthrough on how to launch Amazon ECS and then deploy a sample app by creating a task definition, scheduling tasks, configuring a cluster, and scaling in and out. We also covered creating new revisions for the existing task definitions to deploying the latest updated Docker images.

In this article, we will have a look at cleaning up the 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 your resources up, you won’t be able to do so because of Cloud Formation.

Below are the steps that you have to follow in order to clean up Amazon ECS resources.

Scale Down Services

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

1-copy

1.png


Delete Services

Then we must delete the same services inside that cluster. After our service has scaled down to ‘0’ tasks, 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

Deregister Task Definitions

Under the Task definition navigation pane, select all the revisions of a definition that you want to clean up and click on Deregister.

3

Deregister Container Instances

Before we can delete a cluster, we must deregister the container instances inside that cluster. For each container instance inside our cluster, it's a matter of selecting them and deregistering them as shown below.

4

5.png

Delete a Cluster

Finally, we have removed the active resources from our Amazon ECS cluster. Go to the Clusters navigation pane and delete the cluster by clicking on the ‘Delete cluster’ button.

6.png

7

This will clean up your cluster recourses.

I hope through this series of blogs, you are now able to launch Amazon ECS cluster, deploy your application in a container environment, and easily scale in/scale out your tasks and container instances.

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

Entity component system Docker (software)

Published at DZone with permission of Prashant Goel, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Terraform Controller: Cloud Resource Self-Service
  • How to Make Git Forget a Tracked File Now in .gitignore
  • What Is Edge Compute? It’s Kind of Like Knitting Dog Hats
  • How to Get GDPR and Customer Communications Right

Comments

Cloud Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo