Open-source LLM

Self-hosted Llama 2 on AWS

Run Meta's Llama 2, in 7B or 70B, behind an OpenAI-compatible API on a GPU instance in your own AWS account. Existing OpenAI tools work with a new base URL, and your prompts stay private.

  • 7B and 70B models
  • OpenAI-compatible API
  • Pay per hour
Llama 2 deployed on AWS by Meetrix

What is Llama 2?

Llama 2 is Meta's pre-trained generative text model family. Its Llama-2-Chat models are tuned for dialogue, and the open weights let you run them on your own hardware instead of calling a hosted API.

What's in the Meetrix Llama 2 AMIs

Each AMI ships the model and an OpenAI-compatible API server on Ubuntu 22.04, ready on a g4dn GPU instance.

How to set up a self-hosted Llama 2 API

  1. Pick a size

    Choose 7B or 70B and check your account has vCPU quota for the matching g4dn instance.

  2. Launch the stack

    Subscribe on AWS Marketplace and launch the CloudFormation stack with your domain and admin email.

  3. Point your domain at it

    After 5-10 minutes, create a DNS record with the PublicIp from the stack outputs.

  4. Call the API

    Open the DashboardUrl for the API docs, then point your OpenAI client at your server.

Deploy on AWS

Llama 2 models

ModelRecommended instanceSupported instancesAWS
Llama 2 7Bg4dn.xlargeg4dn.xlarge to g4dn.metalLaunch on AWS
Llama 2 70Bg4dn.12xlargeg4dn.12xlarge, g4dn.metalLaunch on AWS

Llama 2 API endpoints

EndpointPurpose
/v1/chat/completionsChat completions from a list of messages
/v1/completionsCompletions from a prompt
/v1/embeddingsEmbeddings for input text
/v1/engines/copilot-codex/completionsCodex-style code completions
/v1/modelsList available models

The developer guide includes a small Node.js script that checks every endpoint. Read the Llama 2 developer guide →

Video: Llama AMI installation walkthrough (shown with Llama 3)

Llama 2 FAQ

What is Llama 2?

Meta's pre-trained generative text model family, packaged here with an OpenAI-compatible API.

Which size should I choose?

7B on g4dn.xlarge for lower cost and faster responses; 70B on g4dn.12xlarge for more capable output.

Is it compatible with the OpenAI API?

Yes. It serves the OpenAI chat, completions, embeddings and models endpoints, so OpenAI SDKs work with a new base URL.

How do I test the API?

The developer guide has a Node.js script that calls /completions, /embeddings, /chat/completions and /models and prints the results.

What if I see a 502 Bad Gateway error?

The model is still loading. Wait about 5 minutes and refresh.

What if SSL does not set up automatically?

That happens when the domain is not on Route 53. SSH in and run sudo /root/certificate_generate_standalone.sh.

Is there a free trial?

No. The listings are billed per hour of software use plus the EC2 instance.

Llama guides and articles

Need a hand with Llama?

We build and run self-hosted AI infrastructure every day, from model selection to GPU sizing. Tell us what you need.

Contact us