Running Python scripts/APIs on ECS

0

I have multiple Python scripts within a Docker image, each with its input parameters, and I intend to execute them as needed on Amazon Elastic Container Service (ECS).

I have the following scripts inside the docker image:

  • extract_satellite_data.py
  • calculates_ndvi.py

The scripts above require variable input parameters, such as 'sensor' (e.g., 'sentinel2') and 'config_file' (which is a YAML file containing start and end dates, among other things).

Is it possible to define ECS task definitions for each Python script above from the same Docker image and run with the required command-line arguments?

feita há 8 meses1054 visualizações
2 Respostas
1
Resposta aceita

Before start the questions I'd like to comment first about this sentence that you shared:

multiple Python scripts within a Docker image

From Docker documentation: avoid one container being responsible for multiple aspects of your overall application. That said, I'd work to improve this and have different images for each script (thinking that each script will be the main container process).

Doing the above will facilitate a lot your life for the other tasks. Since you'll have 2 containers (one for each script), you should be able to pass the environment variables using the Task Definition Environments and copying the configuration file (YAML) while building the image.

Hope this helps you!

profile pictureAWS
respondido há 8 meses
1

Hello.

In the ECS task definition, "entryPoint" and "command" are the values for setting up script execution.
https://docs.aws.amazon.com/AmazonECS/latest/userguide/task_definition_parameters.html#container_definitions

profile picture
ESPECIALISTA
respondido há 8 meses

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas