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?

demandé il y a 8 mois1052 vues
2 réponses
1
Réponse acceptée

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
répondu il y a 8 mois
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
EXPERT
répondu il y a 8 mois

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions