DZone
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
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
The Latest "Software Integration: The Intersection of APIs, Microservices, and Cloud-Based Systems" Trend Report
Get the report
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. 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 · Tutorial
Like (2)
Save
Tweet
Share
6.44K 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

  • 19 Most Common OpenSSL Commands for 2023
  • A Beginner’s Guide To Styling CSS Forms
  • Distributed Tracing: A Full Guide
  • Assessment of Scalability Constraints (and Solutions)

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • 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: