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?

已提問 8 個月前檢視次數 1053 次
2 個答案
1
已接受的答案

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
已回答 8 個月前
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
專家
已回答 8 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南