What is it?
However, they have too many flags to just do one thing: run a command. Also, those tools don't give the command output, and there are different flags or even tools to get it.
So what if there was a project- and environment-specific config with all the settings, so that you can concentrate only on a command you want to run?
There it is
So that's it:
$ecs-tool run -h Runs the specified command on an ECS cluster, optinally catching its output. It can modify the container command. Usage: ecs-tool run [flags] Flags: --container_name string Name of the container to modify parameters for -h, --help help for run -l, --log_group string Name of the log group to get output Global Flags: -c, --cluster string name of cluster (required) --config string config file to use. Overrides -e/--environment lookup -e, --environment string look up config based on the environment flag. It looks for ecs-$environment.toml config in infra folder. -p, --profile string name of profile to use -t, --task_definition string name of task definition to use (required)
There are a couple of required flags, but they can be set either via enviromental variables or in the config.
It is possible to define a specific config by using
--config flag, or rely on
ecs-tool to look it up based on
The tool then will search for
Just try running
ecs-tool envs in a project folder to discover available environments.
It is as simple as this (while being in the project folder
$ecs-tool run -e production -- uptime 2018/07/26 09:52:24 info Using config file: /Users/user/company/project_name/infra/ecs-production.toml 2018/07/26 09:52:26 info waiting for the task to finish task_definition=project_name-production-app 21:52:28 up 16 days, 10:45, load average: 0.00, 0.02, 0.00
Even more, it is possible to configure
ecs-tool via environmental variables instead of using config. Every flag has to be uppercased and prefixed by
--cluster can be set by
ECS_CLUSTER environmental variable, or
ecs-tool exit code is the same as the container exit code.
It is handled by aws-sdk-go and supports all standard methods: env vars,
rpm packages and binaries for those who don't use packages. Just head up to the releases page.
For Mac users there is one simple command:
brew install springload/tools/ecs-tool.