Deploying to AWS ECS
Run your backend on Amazon ECS with Fargate using a simple container image and service definition.
Guide
Prerequisites
- AWS account with permissions for ECS, ECR, and IAM
- AWS CLI v2 configured (
aws configure) - An existing VPC with private subnets and security groups for ECS
- Container registry (ECR) and your backend repository
Generate Environment Variables
Navigate to Rivet and click Connect > Manual. Copy the environment variables provided, they will be used in the task definition. They should look something like this:
Package Your App
Create a Dockerfile in your project root:
Build and Push the Image
Authenticate to ECR, build the image, and push it. Replace the AWS account, region, and repository names with your own.
Create the Task Definition
Create backend-task.json describing the ECS task. Update the ARNs, subnets, and security groups for your environment.
Register the task definition:
Launch the Service
Create or reuse an ECS cluster, then launch a service with the new task definition. Substitute your subnet and security group IDs.
Verify the Runner
Check that the task is running:
Your runner should appear as connected on the Rivet dashboard once the task is healthy.