- Create a
custom.tfvarsfile with defined variables detailed ininputs.tf - Run
terraform plan -var-file="custom.tfvars" - Once satisfied with the plan run
terraform apply -var-file="custom.tfvars"
- It may take a few minutes after
terraform applyfinishes for Ollama to be up and running. You can runcloud-init status --waitinside the EC2 instance to confirm that the User Data script has finished running.
From your local machine you can now run commands like:
curl http://<ec2_public_dns>:11434/api/generate -d '{
"model": "llama3.1",
"prompt": "Why is the sky blue?",
"stream": false
}'