I am trying to use ecs-cli compose to manage my services and tasks on Amazon ECS.
I'm unable to find a way using the service up
command to create a new service with an application load balancer (even when that load balancer already exists).
This seems possible with service create
, but the API is different from the service up
API, and I'm not sure how to specify params in the same way with create
. And it would generally be preferable to use just the up
command for consistency. The documentation is pretty scattered, there's many different ways to do the same things, just wondering what best practice is here. Any suggestions greatly appreciated.
Worth noting, everything is working for me, so long as I have an existing task definition and I create my service through the Amazon AWS GUI while specifying the load balancer. So I'm thinking about moving all my compose config into a task-definition.json and use it directly with aws ecs
cli.
I have a working docker-compose.yml
file:
# docker-compose.yml
version: "3"
services:
application:
image: ${IMAGE_ARN}
command: npm start
ports:
- "8000:8000"
nginx:
image: ${IMAGE_ARN}
ports:
- "80:80"
And an accompanying ecs-params.yml
file:
# ecs-params.yml
version: 1
task_definition:
task_role_arn: ${ROLE_ARN}
task_execution_role: ${ROLE_ARN}
ecs_network_mode: awsvpc
task_size:
mem_limit: 0.5GB
cpu_limit: 256
container_definitions:
- name: application
- name: nginx
run_params:
network_configuration:
awsvpc_configuration:
assign_public_ip: ENABLED
subnets:
- ${SUBNET_1_ID}
- ${SUBNET_2_ID}
security_groups:
- ${SECURITY_GROUP_ID}
The command that I run to bring the service up is:
ecs-cli compose service up \
--file docker-compose.yaml \
--ecs-params ecs-params.yaml \
--project-name service-name
Any way to specify the load balancer configuration through that command?