Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Valheim Dedicated Server on AWS ECS Fargate

Terraform infrastructure to deploy a Valheim dedicated server on AWS ECS Fargate with EFS persistent storage and S3 backups.

Architecture

  • ECS Fargate - Serverless container compute (2 vCPU, 4GB RAM)
  • EFS - Persistent storage for world saves
  • S3 - Backup storage with 30-day lifecycle
  • CloudWatch - Container logs
  • VPC - Isolated network with public IP

Prerequisites

  • AWS CLI configured (aws configure)
  • Terraform >= 1.0
  • AWS account with IAM permissions for ECS, EFS, S3, VPC

Quick Start

  1. Clone and initialize:
git clone <your-repo>
cd valheim-ecs
terraform init
  1. Configure (optional): Edit terraform.tfvars:
server_name = "4mp3d's Server"
world_name = "Dedicated"
password = "Eriksson"
aws_region = "us-east-1"
  1. Deploy:
terraform plan
terraform apply
  1. Get server IP:
aws ecs describe-tasks
--cluster valheim-cluster
--tasks $(aws ecs list-tasks --cluster valheim-cluster --query 'taskArns[0]' --output text)
--query 'tasks[0].attachments[0].details[?name==networkInterfaceId].value'
--output text | xargs aws ec2 describe-network-interfaces
--network-interface-ids | grep PublicIp
  1. Connect in Valheim:
  • IP: YOUR_IP:2456
  • Password: Eriksson

Server Configuration

Setting Value Description
Server Name 4mp3d's Server Display name in server list
World Dedicated World save name
Password Eriksson Connection password
Save Interval 30 min Auto-save frequency
Backups 3 rolling Every 2 hours, kept 6 hours
Modifiers Raids: Much Less Reduced raid frequency

Costs

~$50-60/month running 24/7:

  • ECS Fargate (2 vCPU, 4GB): ~$45
  • EFS (10GB): ~$3
  • S3 backups: ~$0.50
  • Data transfer: ~$5-10

Management Commands

View logs:

aws logs tail /ecs/valheim --follow

Stop server (keeps data):

aws ecs update-service --cluster valheim-cluster --service valheim-server --desired-count 0

Start server:

aws ecs update-service --cluster valheim-cluster --service valheim-server --desired-count 1

Download backup:

aws s3 sync s3://$(terraform output -raw backup_bucket)/backups/ ./local-backups/

Destroy

⚠️ Warning: This deletes your world data in EFS. Back up first!

terraform destroy

Troubleshooting

Issue Solution
"Wrong password" Check SERVER_PASS env var in task definition
Container keeps stopping Check CloudWatch logs: aws logs tail /ecs/valheim
Can't connect Verify security group allows UDP 2456-2458
No server in browser Wait 2-3 minutes for Steam registration

Files

  • main.tf - Main infrastructure (VPC, ECS, EFS, S3)
  • variables.tf - Input variables
  • terraform.tfvars - User configuration

Credits

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages