GithubHelp home page GithubHelp logo

elb-presence's Introduction

CoreOS ELB Presence Service

Docker Repository on Quay.io

This Docker container allows you to (de)register an EC2 instance with an Amazon Elastic Load Balancer (ELB).

Usage

As a Docker container

The elb-presence container takes all of its configuration from environment variables.

docker run --rm --name example-presence -e AWS_ACCESS_KEY=AKIAIBC5MW3ONCW6J2XQ -e AWS_SECRET_KEY=qxB5k7GhwZNweuRleclFGcvsqGnjVvObW5ZMKb2V -e AWS_REGION=us-east-1 -e ELB_NAME=ExampleLoadBalancer quay.io/coreos/elb-presence
  • AWS_ACCESS_KEY ... Your AWS access key
  • AWS_SECRET_KEY ... Your AWS secret key
  • AWS_REGION ... The AWS region that your load balancer is located in
  • ELB_NAME ... The exact name of your load balancer

Via Fleet

Usually you'll want to manage the lifecycle of your presence service using fleet. To do so, you can create a service file similar to this example:

[email protected]

[Unit]
Description=Example Presence Service
BindsTo=my-service@%i.service

[Service]
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill %p-%i
ExecStartPre=-/usr/bin/docker rm %p-%i
ExecStartPre=/usr/bin/docker pull quay.io/coreos/elb-presence:latest
ExecStart=/usr/bin/docker run --rm --name %p-%i -e AWS_ACCESS_KEY=AKIAIBC5MW3ONCW6J2XQ -e AWS_SECRET_KEY=qxB5k7GhwZNweuRleclFGcvsqGnjVvObW5ZMKb2V -e AWS_REGION=us-east-1 -e ELB_NAME=ExampleLoadBalancer quay.io/coreos/elb-presence
ExecStop=/usr/bin/docker stop %p-%i

[X-Fleet]
MachineOf=my-service@%i.service

This service will deploy to the same machine as your service (MachineOf) and automatically start and stop along with it (BindsTo).

IAM Policy

If you want to create a minimum privilege IAM user for this presence service, here is an example IAM Inline Policy for you to use.

Note that you will have to replace the arn:... URN with your loadbalancer's.

{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Action": [
      "elasticloadbalancing:DeregisterInstancesFromLoadBalancer",
      "elasticloadbalancing:RegisterInstancesWithLoadBalancer"
    ],
    "Resource": "arn:aws:elasticloadbalancing:us-west-1:001340051967:loadbalancer/ExampleLoadBalancer"
  }]
}

elb-presence's People

Contributors

bcwaldon avatar rckclmbr avatar avianflu avatar oremj avatar justmoon avatar

Watchers

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