项目作者: reflog

项目描述 :
Tiny Go CLI Program to run a one-shot (single execution) script on ECS
高级语言: Go
项目地址: git://github.com/reflog/ecs-oneshot-task.git
创建时间: 2018-01-16T08:13:30Z
项目社区:https://github.com/reflog/ecs-oneshot-task

开源协议:BSD 3-Clause "New" or "Revised" License

下载


ecs-oneshot-task

Tiny Go CLI Program to run a one-shot (single execution) script on ECS. Think of it as a tiny AWS Lambda without time or memory constraints.

Build Status

usage

  1. usage: ecs-oneshot-task --cluster=CLUSTER --task-json=TASK-JSON [<flags>]
  2. Flags:
  3. --help Show context-sensitive help (also try --help-long
  4. and --help-man).
  5. --debug Enable debug mode.
  6. -c, --cluster=CLUSTER Name of the ECS cluster
  7. -t, --wait=5m How long to wait for task to finish
  8. -n, --task-name="oneshot" Name of the task to create in the cluster
  9. -j, --task-json=TASK-JSON JSON file with task definition describing the
  10. container running the task
  11. --pass-aws-keys Add AWS keys to task's environment.
  12. -p, --params=PARAMS ... Parameter that can be used inside the JSON file
  13. using Go templating
  14. -k, --aws-access-key-id=AWS-ACCESS-KEY-ID
  15. AWS Access Key ID to use (overrides environment)
  16. -s, --aws-secret-key=AWS-SECRET-KEY
  17. AWS Secret Access Key to use (overrides
  18. environment)
  19. -r, --aws-region=AWS-REGION AWS Region to user (overrides environment)
  20. --version Show application version.

usage example

In the container folder you can see a sample Docker definition for a container that can fetch a script from S3 on start and then execute it.
Using this program, we supply a ECS task definition JSON (i.e. what container to take, how much memory to give it and what environment variables to passO and the name of the cluster to run on and the task will be registered, executed, will wait until it’s over and removed from definitions.

tips

You can utilize logConfiguration inside task JSON to add logging. See AWS ECS documentation