Manage ecs service


License
MIT
Install
pip install ecs-manager==0.1.2.9

Documentation

ECS manager

PyPI version

It is a wrapper tool for using AWS ECS.

You can execute from task registration to service startup with a simple command.

Usage

pip install ecs_manager

ecs_manager deploy-service test-service -c default -t "[{\"name\":\"sleep\",\"image\":\"busybox\",\"cpu\":10,\"command\":[\"sleep\",\"360\"],\"memory\":10,\"essential\":true}]" -s '{"desiredCount": 1}'

NAME

The name of the service you create

cluster

AWS ECS Cluster name

task_container_definition

Task Container Definition(JSON).

http://docs.aws.amazon.com/en_us/AmazonECS/latest/developerguide/example_task_definitions.html

for example.

    {
      "name": "wordpress",
      "links": [
        "mysql"
      ],
      "image": "wordpress",
      "essential": true,
      "portMappings": [
        {
          "containerPort": 80,
          "hostPort": 80
        }
      ],
      "memory": 500,
      "cpu": 10
    },
    {
      "environment": [
        {
          "name": "MYSQL_ROOT_PASSWORD",
          "value": "password"
        }
      ],
      "name": "mysql",
      "image": "mysql",
      "cpu": 10,
      "memory": 500,
      "essential": true
    } 

service_definition

Service definition(JSON).

http://docs.aws.amazon.com/AmazonECS/latest/developerguide/service_definition_parameters.html

for example,

{"desiredCount": 1}

name will be overrided by NAME, you passed command.

environment

You can also override envirnments variables in containerDefinitions.

variables

if you set variables on your task, use {{ xxx }} in task.json with option -v {'xxx': 'value'}

task definition only mode

You can add --task_definition_only option for registering task definition without updating ecs service

ecs_manager deploy-service test-service --task_definition_only -c default -t "[{\"name\":\"sleep\",\"image\":\"busybox\",\"cpu\":10,\"command\":[\"sleep\",\"360\"],\"memory\":10,\"essential\":true}]" -s '{"desiredCount": 1}'