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.
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
Step 3: Set Up the Deployment
- Under the "Set up your first deployment" section, click on "Set up 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
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.
NAME | VALUE |
---|---|
OPENROUTER_API_KEY | <your-api-key> |
OPENROUTER_MODEL | deepseek/deepseek-chat-v3-0324:free |
STUDENT_NAME | <your-name> |
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).
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
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.
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.
This guide should help you get CloudMart up and running on AWS LightSail using environment variables for configuration.
Top comments (0)