DEV Community

Md. Ishraque Bin Shafique
Md. Ishraque Bin Shafique

Posted on

Deploying Containerized Application on AWS LightSail with OpenRouter Integration

AWS LightSail is a simple and cost-effective way to run containers, virtual servers, and managed services without complex configurations. It’s ideal for developers who want quick deployments with predictable pricing. In this guide, we’ll deploy CloudMart, a lightweight web application, on LightSail using a public container image. The app integrates with OpenRouter, a powerful API gateway for accessing multiple LLMs (Large Language Models), allowing intelligent AI interactions within your containerized environment. By setting environment variables for OpenRouter, you can easily connect your deployed application to advanced AI models.


Step 1: Log in to AWS LightSail

  • Navigate to the AWS LightSail service on the AWS Management Console.

AWS Console

AWS Lightsail


Step 2: Create a New Container Service

  • Click on the "Create Container Service" button.
  • Keep the default Container service location selected zone.
  • Select the power Mi - Micro
  • Keep the scale at 1

Create A New Container Service


Step 3: Set Up the Deployment

  • Under the "Set up your first deployment" section, click on "Set up deployment".

Setting Up Custom Deployment


Step 4: Upload Your Container Image

  • Select "Specify a custom deployment".
  • Provide the container image name, tag, and registry as below:
  • Container name: cloudmart
  • Image:
public.ecr.aws/l4c0j8h9/acw-cloudmart-en:latest
Enter fullscreen mode Exit fullscreen mode

Step 5: Configure Environment Variables

  • Create an account in openrouter.ai to get API Key.
  • Go to the Settings Menu and then API Keys to create a new API Key.
  • Go to LightSail console and select “Add environment variables”
  • In the environment variables section, add the key-value pairs based on the application needs.

OpenRouter Dashboard

Create API Keys

NAME VALUE
OPENROUTER_API_KEY <your-api-key>
OPENROUTER_MODEL deepseek/deepseek-chat-v3-0324:free
STUDENT_NAME <your-name>

Setting Up Key Value Pairs


Step 6: Assign a Public Endpoint

  • Select “Add open ports”
  • Add port 5001/HTTP to the open ports
  • Under the "Public Endpoint" section, select cloudmart to configure the container to expose the desired port (5001 for HTTP).

Setting Up Public End Point


Step 7: Identify your service

  • In the Identify your service section*,* provide your name (without spaces) so that LightSail can create a personalized URL for you to access your application: i.e: ishraque-cloudmart

Adding A Custom URL


Step 8: Deploy the Container

  • Click "Create container service" to start the deployment process.
  • Wait for the container to be deployed and the service to become active.

Deploy The Container!!

LightSail Container Deployment Ready


Step 9: Test Your Deployment

  • Copy the public URL of your container service.
  • Open the URL in a web browser to verify that CloudMart is running successfully.

Ishraque CloudMart

This guide should help you get CloudMart up and running on AWS LightSail using environment variables for configuration.

Top comments (0)