There's more...

Our scraper is running on an m4.large instance, so we would like to shut it down to we don't exceed our free-tier usage.  This is a two-step process. First, the EC2 instances in the cluster need to be terminated, and the cluster deleted.  Note that deleting the cluster DOES NOT terminate the EC2 instances.

We can terminate the EC2 instance using the following (and the instance ID we just got from interrogating the cluster):

$ aws ec2 terminate-instances --instance-ids i-08614daf41a9ab8a2{  "TerminatingInstances": [    {      "CurrentState": {        "Name": "shutting-down",        "Code": 32      },      "PreviousState": {        "Name": "running",        "Code": 16      },      "InstanceId": "i-08614daf41a9ab8a2"    }  ]}

And the cluster can be deleted with:

$ aws ecs delete-cluster ...

Get Python Web Scraping Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.