running python script with an ECS task
<p>I have an ECS task setup which, when with a Command override <strong>ls</strong>, produces expected results with my CloudWatch log stream: <strong>test.py</strong>.  my script <strong>test.py</strong> takes one parameter.  I am wondering how I can execute this script with python3 (which exists in my container) using the command override.  Essentially, I want to execute the command:</p>

<pre><code> python3 test.py hello
</code></pre>

<p>how can I do this?</p>

<p>Here's how I did something similar:</p>

<p>In your docker build file, make the command you want to run as the last instruction. In your case:</p>

<pre><code>CMD python3 test.py hello
</code></pre>

<p>To make it more extensible, use environment variables. For instance, do something like:</p>

<pre><code>CMD ["python3", "test.py"]
</code></pre>

<p>But make the parameter come from an environment variable you pass into the container definition in your task.</p>

python amazon-ecs