You want to deploy a Docker container on AWS.

You build your application, create a Docker image, and prepare to publish it. Then the infrastructure work begins:

  • VPC configuration
  • Public and private subnets
  • Route tables
  • Internet Gateway
  • Security groups
  • Load balancers
  • Container orchestration

These components are useful when you need flexibility and control. But what if you simply want to deploy a small application and make it publicly accessible?

Amazon Lightsail Container Services offers a simpler option.

With plans starting at $7 per month, Lightsail lets you deploy containerized applications without manually creating and managing a complete VPC architecture for this use case.

In this tutorial, we'll build a small Node.js application, package it with Docker, push the image to Lightsail, and deploy it with a public endpoint.

1. What Is Amazon Lightsail Container Services?

Amazon Lightsail is an AWS service designed to simplify cloud hosting.

It provides options for running virtual servers, containers, managed databases, and other infrastructure resources through a streamlined experience.

Lightsail Container Services allow developers to deploy container images without managing a full container orchestration platform themselves.

Why use it?

A traditional container deployment might require you to configure several infrastructure components:

Component Purpose
VPC Network isolation
Subnets Network segmentation
Route tables Traffic routing
Internet Gateway Internet connectivity
Security groups Network access control
Load balancer Distribute application traffic
Container platform Run application containers

Lightsail abstracts much of this setup and provides a managed public endpoint.

One important clarification: "Skip the VPC" means you do not need to create and manage your own VPC architecture for this deployment. AWS still manages the underlying networking infrastructure.

2. Understanding the $7 Plan

The Lightsail Container Services Nano plan starts at $7 per month.

Resource Nano plan
Monthly price $7
vCPU 0.25 shared vCPU
Memory 512 MB
Monthly data-transfer quota 500 GB

This can be useful for:

  • Personal projects
  • Small web applications
  • MVPs and prototypes
  • Lightweight APIs
  • Learning Docker and AWS container deployment

Check the official Lightsail pricing page before deploying. Pricing, regional availability, and data-transfer charges can change. Additional resources or usage may increase the total cost.

3. What Are We Going to Build?

We'll deploy a basic Node.js application inside a Docker container.

The deployment flow will look like this:

Developer | v Node.js Application | v Docker Image | v Amazon Lightsail | v Managed Public HTTPS Endpoint | v Users 

The application will listen on port 8080 and expose a health-check endpoint.

4. Create the Node.js Application

Create a project directory:

mkdir lightsail-container-demo cd lightsail-container-demo 

Create a file named server.js:

const http = require("http"); const PORT = process.env.PORT || 8080; const server = http.createServer((req, res) => { if (req.url === "/healthz") { res.writeHead(200, { "Content-Type": "application/json" }); res.end(JSON.stringify({ status: "healthy" })); return; } res.writeHead(200, { "Content-Type": "text/html" }); res.end(` <html> <head> <title>Lightsail Container Demo</title> </head> <body> <h1>Hello from Amazon Lightsail!</h1> <p>My Docker container is running on AWS.</p> </body> </html> `); }); server.listen(PORT, "0.0.0.0", () => { console.log(`Server listening on port ${PORT}`); }); 

The application has two routes:

  • / displays a welcome page.
  • /healthz returns a simple health status.

Listening on 0.0.0.0 allows the application to accept connections from outside the container.

5. Create the Dockerfile

Create a file named Dockerfile:

FROM node:22-alpine WORKDIR /app COPY server.js . EXPOSE 8080 CMD ["node", "server.js"] 

Build the Docker image:

docker build -t lightsail-demo . 

Run the container locally:

docker run -p 8080:8080 lightsail-demo 

Open:

http://localhost:8080 

Test the health endpoint:

curl http://localhost:8080/healthz 

Expected response:

{"status":"healthy"} 

If the application works locally, we can move to AWS.

6. Configure AWS CLI

Before deploying, make sure you have:

  • An AWS account
  • AWS CLI installed
  • Docker installed
  • AWS credentials configured
  • Permissions to manage Lightsail container services

Configure your AWS CLI:

aws configure 

Install and configure lightsailctl by following the official AWS instructions. This plugin enables the AWS CLI to upload container images to Lightsail.

7. Create a Lightsail Container Service

Let's create a Nano container service:

aws lightsail create-container-service \ --service-name lightsail-demo \ --power nano \ --scale 1 \ --region us-east-1 

This creates a container service with one Nano node in us-east-1.

You can select another supported AWS Region based on your application requirements and user locations.

8. Push the Docker Image to Lightsail

Now upload the Docker image:

aws lightsail push-container-image \ --service-name lightsail-demo \ --label node-demo \ --image lightsail-demo:latest \ --region us-east-1 

The command uploads your image and returns an image reference.

Save that image reference. You'll need it in the next step.

9. Configure the Container

Create a file named containers.json.

Use the image reference returned by the previous command:

{ "node-demo": { "image": "YOUR_LIGHTSAIL_IMAGE_REFERENCE", "ports": { "8080": "HTTP" } } } 

Replace the placeholder with your actual Lightsail image reference.

Next, create public-endpoint.json:

{ "containerName": "node-demo", "containerPort": 8080, "healthCheck": { "path": "/healthz", "successCodes": "200" } } 

These files describe the container and the public endpoint configuration. Check the current AWS CLI documentation for the exact supported configuration schema and health-check options.

10. Deploy the Container

Run the deployment command:

aws lightsail create-container-service-deployment \ --service-name lightsail-demo \ --containers file://containers.json \ --public-endpoint file://public-endpoint.json \ --region us-east-1 

Lightsail will start deploying the container.

Check the service status:

aws lightsail get-container-services \ --service-name lightsail-demo \ --region us-east-1 

Wait until the service and deployment are ready.

Retrieve the public endpoint from the service details and open it in your browser.

You should see:

Hello from Amazon Lightsail!

Your Dockerized Node.js application is now running on AWS.

11. What Does Lightsail Manage for You?

One of the biggest advantages of Lightsail is the simplified operational experience.

Responsibility Lightsail approach
Container hosting Managed container service
Image upload AWS CLI and lightsailctl
Public access Managed public endpoint
HTTPS Managed endpoint
Service capacity Select a plan and scale
Infrastructure configuration Simplified management experience

You don't need to manually build every networking component for this deployment.

However, this abstraction also means you have less control over some infrastructure details than you would with a more customizable architecture.

12. When Should You Use Lightsail?

Lightsail Container Services can be a practical choice when you need:

A personal project: Publish a small application without managing a large cloud environment.

An MVP: Validate an idea before investing in a more complex architecture.

A portfolio application: Demonstrate Docker and AWS deployment skills.

A lightweight API: Host a small backend service.

A learning environment: Understand container deployment without starting with a full orchestration platform.

13. When Should You Choose ECS or EKS?

Lightsail is not a replacement for every AWS container service.

As your application grows, you may need more control over networking, orchestration, scaling, deployment strategies, and integrations.

Requirement AWS option
Simple container hosting Lightsail Container Services
Flexible managed container orchestration Amazon ECS
Kubernetes workloads Amazon EKS
Serverless containers AWS Fargate with ECS or EKS
Complex microservices architecture ECS or EKS with supporting services

Choose the platform based on your operational requirements rather than assuming that the most complex architecture is always the best one.

14. Security and Cost Considerations

Before using Lightsail for a real application, keep these points in mind.

Cost

The $7 starting price is not necessarily the total cost of every deployment.

Consider:

  • Service plan and number of nodes
  • Data-transfer usage beyond the included quota
  • Other AWS resources used by your application
  • Regional pricing
  • Application resource consumption

Review the Lightsail pricing page for current details.

Security

Follow basic container security practices:

  1. Use minimal and trusted base images.
  2. Keep application dependencies updated.
  3. Never place AWS credentials inside your Docker image.
  4. Expose only the ports your application needs.
  5. Store secrets securely.
  6. Implement health checks.
  7. Monitor application logs and resource usage.
  8. Apply least-privilege IAM permissions.

For production workloads, also plan for backups, monitoring, incident response, and recovery.

15. Final Thoughts

Not every application needs a complex cloud architecture.

Sometimes you just want to build an application, package it into a Docker image, deploy it, and make it available to users.

Amazon Lightsail Container Services provides a simpler way to do that.

With a starting plan of $7 per month, developers can experiment with container hosting and avoid much of the infrastructure configuration associated with more advanced container platforms.

The key is choosing the right level of complexity.

Start with Lightsail when simplicity is enough. Move to ECS or EKS when your application needs more control, flexibility, or orchestration capabilities.

Build your container. Deploy it. Get your application online. Spend more time writing code and less time managing infrastructure.

Useful AWS Resources

Have you deployed containers using Lightsail, ECS, or EKS? Share your experience in the comments!

AWS #Docker #DevOps #Cloud