Skip to content
A small, simple ecs-watchbot example
JavaScript Dockerfile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

readme.md

ecs-telephone

A super simplistic example of using ecs-watchbot to spread misinformation. 🤖 ☎️

What does it do?

Ever played the game "Telephone"? It takes in a message, replaces a word, then sends the new message back to itself to do the task again. Eventually the original message is completely lost. But hey, at least you're learning about ecs-watchbot!

How to spin it up

0. Requirements

cfn-config: All of this requires you to be authenticated with an AWS account. The following steps will use a tool called cfn-config, which enables you to deploy services via cloudformation. Read the docs on how to set up and authenticate your environment.

an ECS cluster: ecs-watchbot requires an ECS cluster to work. Learn more about ECS clusters on AWS.

1. Clone this repository

git clone git@github.com:mapbox/ecs-telephone.git
cd ecs-telephone

2. Create a new stack

cfn-config create <stack_name>

This will create a new stack with all of the resources specified by ecs-watchbot. It will ask for two inputs:

  1. GitSha - default to the current local git tree (you can just press enter)
  2. Cluster - this needs to be the ECS Cluster ARN where you want the stack to be located - this looks like arn:aws:ecs:us-east-1:....
You'll see logs like this...
~/mapbox/ecs-telephone[master]$ cfn-config create howdy
23:28:03Z us-east-1: creating stack ecs-telephone-howdy
? Saved configurations New configuration
? GitSha: 87bb477ec710c8f7226b364dd465fa1a30227726
? Cluster: arn:aws:ecs:us-east-1:....
? Ready to create the stack? Yes
23:28:15Z us-east-1: CREATE_IN_PROGRESS ecs-telephone-howdy: User Initiated
23:28:17Z us-east-1: CREATE_IN_PROGRESS WatchbotDeadLetterQueue
23:28:19Z us-east-1: CREATE_IN_PROGRESS WatchbotNotificationTopic
23:28:19Z us-east-1: CREATE_IN_PROGRESS WatchbotTaskEventQueue
...
more
...
23:30:29Z us-east-1: CREATE_COMPLETE WatchbotService
23:30:29Z us-east-1: CREATE_COMPLETE WatchbotTaskEventQueuePolicy
23:30:32Z us-east-1: CREATE_COMPLETE ecs-telephone-howdy

3. Send a message

Each ecs-watchbot stack has a queue that it listens to. You can find this queue in the SQS dashboard. Search for your stack (called ecs-telephone-<something>). A) Select the stack and then B) click the "Queue Actions" dropdown. C) Press "Send a Message" and add a JSON formatted message like this:

{
  "Subject": "Your subject",
  "Message": "Your random message to be garbled"
}

abc

4. View logs

Logs are viewable through the AWS console via CloudWatch. You can find the LogGroup associated to your service named something like ecs-telephone-<stack>-us-east-1-.... Clicking this group will show you a number of LogStreams which are logs from individual tasks run by your watchbot service. Each task will have logs that look something like this:

[Thu, 22 Jun 2017 00:30:38 GMT] [watchbot] [68111482-ab11-48b3-b292-6c5dbf22c54e] {"subject":"Attention","message":"make sure to water the plants","receives":"1"}
[Thu, 22 Jun 2017 00:30:52 GMT] [worker] [68111482-ab11-48b3-b292-6c5dbf22c54e] Attention: make sure to locate the plants

If you were to stitch the logs together, you'd see your telephone message distort like this (after sending make sure to water the plants as the original message):

Attention: make sure to water the plants
Attention: make sure to SLAUGHTER the plants
Attention: STEAK sure to SLAUGHTER the plants
Attention: STEAK sure DO SLAUGHTER the GRANTS
Attention: STEAK sure DO SLAUGHTER LE GRANTS
Attention: STEAK FLOOR DO SLAUGHTER LE GRANTS
Attention: CAKE FLOOR DO SLAUGHTER LE GRANTS

5. Delete the stack

This stack continues to send messages back to itself and will never stop until we remove it. Once you've seen the logs, make sure to delete the entire stack!

cfn-config delete <stack>
You can’t perform that action at this time.