Home > OS >  Specifying launch type in docker-compose integration with ECS
Specifying launch type in docker-compose integration with ECS

Time:06-24

Following compose-ECS integration documentation, and looking to output of:

docker --context <my context> compose convert

... for this compose file:

version: "3.9"

services:
  web:
    image: "yeasy/simple-web:latest"

... I get Fargate launch type for ECS service:


AWSTemplateFormatVersion: 2010-09-09
Resources:
  ...
  WebService:
    Properties:
      ...
      LaunchType: FARGATE
    ...
    Type: AWS::ECS::Service
...

It looks like integration is capable of using EC2 launch type, for example, if I use this compose file:

version: "3.9"

services:
  web:
    image: "yeasy/simple-web:latest"
    deploy:
      resources:
        reservations:
          generic_resources:
            - discrete_resource_spec:
                kind: gpus
                value: 2

... I get:

AWSTemplateFormatVersion: 2010-09-09
Resources:
  ...
  WebService:
    Properties:
      ...
      LaunchType: EC2
    ...
    Type: AWS::ECS::Service
...

However, I can't find any way to specify EC2 launch type for service directly. Is this possible using official docker integration?

CodePudding user response:

The docker-compose ECS integration always defaults to Fargate, with the only exception being when you require GPUs, which are currently only available via EC2.

If you want more control over this it's best to use a different tool for managing your infrastructure, such as AWS CoPilot, Terraform, etc.

  • Related