简体   繁体   中英

AWS ECS cli command equivalent in boto3

I'm trying to port in python an ECS services deployment that at the moment is done with a bunch of bash script containing commands like the following:

ecs-cli compose -f foo.yml -p foo --cluster bar --ecs-params "dir/ecs-params.yml" service up

I thought that the easiest/fastest way could be using boto3 (which I already extensively use elsewhere so It's a safe spot), but I didn't understand from the documentation what would be the instruction equivalent of the formerly written command.

Thanks in advance.

UPDATE: this is the content of foo.yml :

version: '3'
services:
  my-service:
    image: ecr-image:version
    env_file:
      - ./some_envs.env
      - ./more_envs.env
    command: python3 src/main.py param1 param2
    logging:
      driver: awslogs
      options:
        awslogs-group: /my-service-log-group
        awslogs-region: my-region
        awslogs-stream-prefix: my-prefix

The ecs-cli is a high level construct that creates a workflow that wraps many lower level API calls. NOT the same thing but you can think of the ecs-cli compose up command the trigger to deploy what's included in your foo.yml file. Based on what's in your foo.yml file you can walk backwards and try to map to single atomic ECS API calls.

None of this answers your question but, for background, the ecs-cli is no longer what we suggest to use for deploying on ECS. Its evolution is Copilot (if you are not starting from a docker compose story) OR the new docker compose integration with ECS (if docker compose is your jam).

If you want / can post the content of your foo.yml file I can take a stab at how many lower level API calls you'd need to make to do the same (or suggest some other alternatives).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM