Coder Social home page Coder Social logo

ecs-hello-world's Introduction

Overview

Demo for Hello World in EC2 Container Service blog post. The blog post describes how to run the demo on ECS. The ecs-hello-world container is on DockerHub for easy deployment to ECS. It uses Ruby 2.1.5 as its Docker Base Image.

Demo

The demo consists of 2 Rake tasks. The client takes in a message and posts a JSON message to a SQS queue.

rake hello:client['hello world!']

Sent: fbe73a51-0684-49de-9195-020c03704c9b

{
  "container": "909fbdc5351e",
  "payload": "hello world!",
  "timestamp": "2015-03-31T09:14:24+02:00"
}

The server polls the queue for messages and outputs them to stdout.

rake hello:server

Received: fbe73a51-0684-49de-9195-020c03704c9b
Container 909fbdc5351e said 'hello world!' at 31 Mar 2015 09:14:24 +02:00

Running Locally

  • Clone the repository
  • Create a SQS queue (see blog post)
  • Create an IAM user and policy for accessing the queue (see blog post)
  • Create a .env file and set the environment variables
AWS_ACCESS_KEY_ID=* IAM access key*
AWS_SECRET_ACCESS_KEY=* IAM secret key
AWS_REGION=eu-west-1 # Other supported regions for ECS are us-east-1 or us-west-1
SLEEP_MILLIS=1000
SQS_ENDPOINT=https://sqs.eu-west-1.amazonaws.com/* Your AWS account num*/ecs-hello-world
$ docker-compose up

License

This code is licensed under the MIT license

ecs-hello-world's People

Contributors

rossf7 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.