Kelvin DeCosta

10/11/2022, 3:54 PM
Hey everyone! I managed to write the necessary Infrastructure as Code (via Pulumi) for a light-weight Prefect agent that runs as an ECS Service. I was hoping to get a nice welcome message in the logs. Unfortunately, I get the
cli help message over and over again. ECS console shows a list of
tasks, which I'm assuming are various attempts to start the service and keep it running.
โœ… 2
Dockerfile for Prefect Agent
FROM prefecthq/prefect:2-python3.10

# Install dependencies for AWS
RUN pip install s3fs prefect-aws

# Register AWS block types
RUN prefect block register -m prefect_aws.ecs
Relevant container configuration, from ECS Task Definition for Prefect Agent, ECS Service
  "name": "container",
  "image": "long-image-identifier",
  "cpu": 0,
  "portMappings": [],
  "essential": true,
  "entryPoint": [
  "command": [
  "environment": [],
  "mountPoints": [],
  "volumesFrom": [],
  "secrets": [
      "name": "PREFECT_API_URL",
      "valueFrom": "long-arn"
      "name": "PREFECT_API_KEY",
      "valueFrom": "long-arn"
  "stopTimeout": 120,
  "logConfiguration": {
    "logDriver": "awslogs",
    "options": {
      "awslogs-group": "my-log-group",
      "awslogs-region": "us-east-1",
      "awslogs-stream-prefix": "container"
I think
is installed correctly, because I'm getting the CLI help message. This makes me wonder if my supplied
is wrong. I'd want the service to run
prefect agent start -q main

Christopher Boyd

10/11/2022, 4:13 PM
Hi Kelvin, not sure if you saw this, but we have some existing recipes that tackle this?
Here is an example task definition:
I donโ€™t think you need the bash entrypoint
โœ… 1
๐ŸŽ‰ 1

Kelvin DeCosta

10/11/2022, 4:21 PM
Hey! Thanks so much for the quick reply I just noticed that I'm using
entryPoint: ["bash" "-c"]
which is wrong. I have been setting up my team's resources by following the
repository. Thank you for these additional links!
๐Ÿ™Œ 1