This example uses the AWS VPC module to create the AWS resources required for a functional ECS cluster to host the Prefect worker.
Once the Terraform plan is applied successfully, you can test it by assigning a
Deployment to the new ECS work pool. An example of the configuration for this
is available in the example prefect.yaml
file.
See the Prefect YAML
documentation for more information.
The build
and push
steps defined in this file will build the sample flow
into a Docker image and push it to the ECR repository created by Terraform. Some portions of
this file will need to be replaced by the unique resource names created in AWS.
Run prefect deploy hello_world.py:hello_world
and follow the prompts. Once complete, you will
see your Deployment in the UI. You can then start a run from the UI, or using the suggested
command from the CLI. The flow run will execute on your new ECS work pool.
As an alternative to prefect.yaml
, deployments can be managed by Terraform using the Prefect provider's
deployment
resource.
Name | Version |
---|---|
aws | ~> 5.0 |
Name | Version |
---|---|
aws | ~> 5.0 |
Name | Source | Version |
---|---|---|
prefect_ecs_worker | prefecthq/ecs-worker/prefect | 1.0.0 |
vpc | terraform-aws-modules/vpc/aws | 5.19.0 |
Name | Type |
---|---|
aws_ecr_repository.example | resource |
No inputs.
No outputs.