How to Setup AWS Tools and Unmonitor EC2 Instances

As paying Amazon AWS Customer I recently visited the AWS Console and activated the CloudWatch service for a specific instance. I was happy to see that it almost immediately started to collect data.

I felt like some important stats were missing, but this is not the point of this post.

I also felt like an important option was missing, and that is precisely the point of this post.

The problem was: There is no way to stop monitoring an instance through AWS Console. This makes perfect sense from Amazon’s point of view since this is the way to make (a little bit of) money.

AWS Command Line tools to the rescue

I downloaded and set up the tools and then was able to issue a request to AWS stating that monitoring of this specific instance had to stop.

Here’s how you do it, it should take around 10 minutes from zero to issuing the request.

  1. Download the AWS Command Line Tools
  2. Set up the Command Line Tools, which basically means
    1. Set environment variables to the tools (EC2_HOME), to your AWS keys and certificates(EC2_PRIVATE_KEY and EC2_CERT), and probably also to Java (JAVA_HOME)
    2. Specify which Region you want to use by setting the EC2_URL variable like so (on Windows):
      set EC2_URL=https://ec2.eu-west-1.amazonaws.com
  3. And then you’re good to go and have a look into the Command Line Reference and issue the request to AWS. In this case, I wanted to stop monitoring an instance, which is then as simple as going into the \bin directory of the AWS tools and issue
    ec2-unmonitor-instances <instanceId>