GithubHelp home page GithubHelp logo

isabella232 / ecs-telephone Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mapbox/ecs-telephone

0.0 0.0 0.0 287 KB

A small, simple ecs-watchbot example

License: ISC License

JavaScript 78.96% Dockerfile 21.04%

ecs-telephone's Introduction

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 [email protected]: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>

ecs-telephone's People

Contributors

arunasank avatar danpat avatar drboyer avatar mapsam avatar npeternel avatar ramshackle-jamathon avatar rclark avatar tmcw avatar vsmart avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.