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?

asked 8 months ago1002 views
2 Answers
1
Accepted Answer

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
answered 8 months ago
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
answered 8 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions