{"id":51178326,"url":"https://github.com/rivet-dev/template-aws-ecs","last_synced_at":"2026-06-27T05:30:26.311Z","repository":{"id":365816802,"uuid":"1128601504","full_name":"rivet-dev/template-aws-ecs","owner":"rivet-dev","description":null,"archived":false,"fork":false,"pushed_at":"2026-01-05T23:46:43.000Z","size":52,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-19T03:22:51.242Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rivet-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-05T22:12:08.000Z","updated_at":"2026-01-05T23:46:47.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/rivet-dev/template-aws-ecs","commit_stats":null,"previous_names":["rivet-dev/template-aws-ecs"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/rivet-dev/template-aws-ecs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rivet-dev%2Ftemplate-aws-ecs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rivet-dev%2Ftemplate-aws-ecs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rivet-dev%2Ftemplate-aws-ecs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rivet-dev%2Ftemplate-aws-ecs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rivet-dev","download_url":"https://codeload.github.com/rivet-dev/template-aws-ecs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rivet-dev%2Ftemplate-aws-ecs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34843146,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-27T02:00:06.362Z","response_time":126,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-27T05:30:23.946Z","updated_at":"2026-06-27T05:30:26.303Z","avatar_url":"https://github.com/rivet-dev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RivetKit AWS ECS Template\n\nA RivetKit application template configured for deployment on AWS ECS (Fargate).\n\n## Local Development\n\n```bash\nnpm install\nnpm run dev\n```\n\n---\n\n## Option A: Deploy with Terraform\n\n\u003e **Note:** This only deploys the actors. You need to deploy the frontend yourself.\n\n### Prerequisites\n\n- [AWS CLI](https://aws.amazon.com/cli/) configured with appropriate permissions\n- [Docker](https://www.docker.com/) installed and running\n- [Terraform](https://www.terraform.io/)\n\n### 1. Create Rivet Project\n\n1. Go to the [Rivet dashboard](https://rivet.dev)\n2. Under **Connect Existing Project**, click **AWS ECS**\n3. Configure datacenter, then click **Next**\n4. Copy the values shown for the next step\n\n### 2. Deploy\n\nSet the environment variables from the Rivet dashboard:\n\n```bash\nexport TF_VAR_rivet_endpoint=\"\u003cpaste from dashboard\u003e\"\nexport TF_VAR_rivet_namespace=\"\u003cpaste from dashboard\u003e\"\nexport TF_VAR_rivet_token=\"\u003cpaste from dashboard\u003e\"\n```\n\nThen deploy:\n\n```bash\ncd terraform\nterraform init\nterraform apply\n```\n\nThis will automatically build and push the Docker image.\n\nTo deploy updates, run `terraform apply` again.\n\n### Cleanup\n\n```bash\ncd terraform\nterraform destroy\n```\n\n---\n\n## Option B: Deploy with AWS CLI\n\n\u003e **Note:** This only deploys the actors. You need to deploy the frontend yourself.\n\n### Prerequisites\n\n- [AWS CLI](https://aws.amazon.com/cli/) configured with appropriate permissions\n- [Docker](https://www.docker.com/) installed and running\n\n### 1. Create Rivet Project\n\n1. Go to the [Rivet dashboard](https://rivet.dev)\n2. Under **Connect Existing Project**, click **AWS ECS**\n3. Configure datacenter, then click **Next**\n4. Copy and run the environment variables shown:\n\n```bash\nexport RIVET_ENDPOINT=\u003cpaste from dashboard\u003e\nexport RIVET_NAMESPACE=\u003cpaste from dashboard\u003e\nexport RIVET_TOKEN=\u003cpaste from dashboard\u003e\n```\n\n### 2. Set AWS Variables\n\n```bash\nexport AWS_REGION=us-east-1\nexport AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)\nexport APP_NAME=my-backend\n```\n\n### 3. Create ECR Repository\n\n```bash\naws ecr create-repository --repository-name ${APP_NAME} --region ${AWS_REGION}\naws ecr get-login-password --region ${AWS_REGION} | \\\n  docker login --username AWS --password-stdin ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com\n```\n\n### 4. Build and Push Docker Image\n\n```bash\ndocker build --platform linux/amd64 -t ${APP_NAME} .\ndocker tag ${APP_NAME}:latest ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/${APP_NAME}:latest\ndocker push ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/${APP_NAME}:latest\n```\n\n### 5. Create CloudWatch Log Group\n\n```bash\naws logs create-log-group --log-group-name /ecs/${APP_NAME} --region ${AWS_REGION}\n```\n\n### 6. Create ECS Cluster\n\n```bash\naws ecs create-cluster --cluster-name ${APP_NAME}-cluster\n```\n\n### 7. Create Task Execution Role (if needed)\n\nIf you don't have an `ecsTaskExecutionRole`, create one:\n\n```bash\naws iam create-role --role-name ecsTaskExecutionRole \\\n  --assume-role-policy-document '{\n    \"Version\": \"2012-10-17\",\n    \"Statement\": [{\n      \"Effect\": \"Allow\",\n      \"Principal\": {\"Service\": \"ecs-tasks.amazonaws.com\"},\n      \"Action\": \"sts:AssumeRole\"\n    }]\n  }'\n\naws iam attach-role-policy --role-name ecsTaskExecutionRole \\\n  --policy-arn arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy\n```\n\n### 8. Register Task Definition\n\n```bash\ncat \u003e /tmp/task-def.json \u003c\u003c EOF\n{\n  \"family\": \"${APP_NAME}\",\n  \"networkMode\": \"awsvpc\",\n  \"cpu\": \"256\",\n  \"memory\": \"512\",\n  \"requiresCompatibilities\": [\"FARGATE\"],\n  \"executionRoleArn\": \"arn:aws:iam::${AWS_ACCOUNT_ID}:role/ecsTaskExecutionRole\",\n  \"containerDefinitions\": [{\n    \"name\": \"${APP_NAME}\",\n    \"image\": \"${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/${APP_NAME}:latest\",\n    \"portMappings\": [{\"containerPort\": 8080, \"protocol\": \"tcp\"}],\n    \"environment\": [\n      {\"name\": \"RIVET_ENDPOINT\", \"value\": \"${RIVET_ENDPOINT}\"},\n      {\"name\": \"RIVET_NAMESPACE\", \"value\": \"${RIVET_NAMESPACE}\"},\n      {\"name\": \"RIVET_TOKEN\", \"value\": \"${RIVET_TOKEN}\"}\n    ],\n    \"logConfiguration\": {\n      \"logDriver\": \"awslogs\",\n      \"options\": {\n        \"awslogs-group\": \"/ecs/${APP_NAME}\",\n        \"awslogs-region\": \"${AWS_REGION}\",\n        \"awslogs-stream-prefix\": \"ecs\"\n      }\n    },\n    \"essential\": true\n  }]\n}\nEOF\naws ecs register-task-definition --cli-input-json file:///tmp/task-def.json\n```\n\n### 9. Configure VPC\n\n**Option A: Use existing VPC**\n\n```bash\nexport VPC_ID=vpc-xxxxxxxxx\nexport SUBNET_ID=subnet-xxxxxxxxx\nexport SG_ID=sg-xxxxxxxxx\n```\n\n**Option B: Create new VPC**\n\n```bash\nexport VPC_ID=$(aws ec2 create-vpc --cidr-block 10.0.0.0/16 --query 'Vpc.VpcId' --output text)\nexport SUBNET_ID=$(aws ec2 create-subnet --vpc-id ${VPC_ID} --cidr-block 10.0.0.0/24 --query 'Subnet.SubnetId' --output text)\nexport SG_ID=$(aws ec2 create-security-group --group-name ${APP_NAME}-sg --description \"ECS security group\" --vpc-id ${VPC_ID} --query 'GroupId' --output text)\nexport IGW_ID=$(aws ec2 create-internet-gateway --query 'InternetGateway.InternetGatewayId' --output text)\naws ec2 attach-internet-gateway --internet-gateway-id ${IGW_ID} --vpc-id ${VPC_ID}\nexport RTB_ID=$(aws ec2 describe-route-tables --filters Name=vpc-id,Values=${VPC_ID} --query 'RouteTables[0].RouteTableId' --output text)\naws ec2 create-route --route-table-id ${RTB_ID} --destination-cidr-block 0.0.0.0/0 --gateway-id ${IGW_ID}\n```\n\n### 10. Create ECS Service\n\n```bash\naws ecs create-service \\\n  --cluster ${APP_NAME}-cluster \\\n  --service-name ${APP_NAME} \\\n  --task-definition ${APP_NAME} \\\n  --desired-count 1 \\\n  --launch-type FARGATE \\\n  --network-configuration \"awsvpcConfiguration={subnets=[${SUBNET_ID}],securityGroups=[${SG_ID}],assignPublicIp=ENABLED}\"\n```\n\n### Deploy Updates\n\n```bash\ndocker build --platform linux/amd64 -t ${APP_NAME} .\ndocker tag ${APP_NAME}:latest ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/${APP_NAME}:latest\ndocker push ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/${APP_NAME}:latest\naws ecs update-service --cluster ${APP_NAME}-cluster --service ${APP_NAME} --force-new-deployment\n```\n\n### Update Environment Variables\n\nUpdate `/tmp/task-def.json` with new values, then re-register and deploy:\n\n```bash\naws ecs register-task-definition --cli-input-json file:///tmp/task-def.json\naws ecs update-service --cluster ${APP_NAME}-cluster --service ${APP_NAME} --task-definition ${APP_NAME} --force-new-deployment\n```\n\n### Cleanup\n\n```bash\naws ecs update-service --cluster ${APP_NAME}-cluster --service ${APP_NAME} --desired-count 0\naws ecs delete-service --cluster ${APP_NAME}-cluster --service ${APP_NAME}\naws ecs delete-cluster --cluster ${APP_NAME}-cluster\naws ecr delete-repository --repository-name ${APP_NAME} --force\naws logs delete-log-group --log-group-name /ecs/${APP_NAME}\n```\n\n---\n\n## After Deployment\n\nYour runner should appear as connected on the Rivet dashboard once the service is healthy.\n\n- View your cluster: https://us-east-1.console.aws.amazon.com/ecs/v2/clusters?region=us-east-1\n- View logs: https://us-east-1.console.aws.amazon.com/cloudwatch/home?region=us-east-1#logsV2:log-groups\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frivet-dev%2Ftemplate-aws-ecs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frivet-dev%2Ftemplate-aws-ecs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frivet-dev%2Ftemplate-aws-ecs/lists"}