Deploying a containerized website using Amazon Ligthsail
Tags: tutorial, aws, cloud, learning
Published: 2023-12-14 10:22:45


**Overview**
Amazon Lightsail is the easiest way to get started with AWS for developers, small businesses, students, and other users who need a solution to build and host their websites and web applications in the cloud. Amazon Lightsail provides easy-to-use cloud resources to get your web application or websites up and running in just a few clicks. Lightsail offers simplified services such as instances, containers, databases, storage, and more. With Lightsail, you can easily spin up websites or applications using pre-configured blueprints like WordPress, Prestashop, or LAMP. You can use Lightsail features to simply host static content, connect your content to an audience around the globe, or get your windows Business server up and running. The Lightsail console guides you through the configuration process, and in many cases, has components already configured.

**Amazon LightSail Offerings**
**Instances:** Lightsail offers virtual servers (instances) that are easy to set up and backed by the power and reliability of AWS. You can launch your website, web application, or project in minutes, and manage your instance from the intuitive Lightsail console or API.
**Containers:** Lightsail offers an easy way to run containers in the cloud. With Lightsail Container Service, customers can now run and securely access containerized applications from the internet with just a few steps. Lightsail Containers enables customers to run Docker containers on the cloud right from their developer workflows. Lightsail creates containers from the Docker images pushed by the developers.
**Simplified load balancers:** Lightsail’s simplified load balancing routes web traffic across your instances so your websites and applications can accommodate variations in traffic, protected against outages, and deliver a seamless visitor experience.
**Managed databases:** Lightsail offers a fully configured MySQL or PostgreSQL databases plan that includes memory, processing, storage, and transfer allowance. With Lightsail managed databases, you can easily scale your databases independently of your virtual servers, improve application availability, or run standalone databases in the cloud.
**Block and object storage:** Amazon Lightsail offers both block and object storage. You can scale your storage quickly and easily with highly available SSD-backed storage for your Linux or Windows virtual server. For Lightsail Object Storage, you can easily host static content on the cloud.
**CDN distributions:** Lightsail enables content delivery network (CDN) distributions, which are built on the same infrastructure as Amazon CloudFront. This allows you to easily distribute your content to a global audience by setting up proxy servers across the world, so that your users across the globe can access your website geographically closer to them, thus reducing latency.
**Upgrade to EC2:** As your cloud ideas expand, you can easily move to EC2 with a simple, guided experience. With this feature, Lightsail offers you the comfort of knowing that as you grow your website or application, we can help you scale in a way that fits your needs.
**Access to AWS services:** you can integrate your Lightsail project with some of other services in AWS through Amazon VPC peering.

**Project Objective:** This project will provide a step-by-step guide to deploying a containerized website using Amazon Ligthsail.

**Prerequisites**
An AWS account: This will grant access to the AWS management console.
A Docker hub account and an image on docker hub to be deployed on Amazon ligthsail. I will be using the image from this repository,
https://hub.docker.com/repository/docker/ojosamuel/e-commerce_terraform/general

**Step 1: Navigating to the Amazon Ligthsail Console**
a. Open the AWS Management Console, in the search bar type Lightsail and click on Lightsail to open the Amazon Lightsail console

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rrs8oegaz9b8iyfeybb4.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6nuglbaxrlzzxtqmmm4m.png)

**Step 2: Create container service.**
• Click on **Container** on the Amazon ligthsail home page.
• Click **Create container service.** 
• **Container Service Location:** choose the region in which you want your container to be deployed. 
• **Choose your container service capacity:** Choose the desired power based on memory and processing need of your application. The corresponding monthly charges are also displayed.
• **Choose the scale:** Choose the number of nodes required for your application. Note that monthly charges are on a per node basis.
• **Set up your first deployment:** Click on the + sign before set up deployment and choose specify a custom deployment
• **Container name:** Give you container s unique name. “e-commerce-website”
• **Image:** Enter the image reference from DockerHub
• **Open ports:** Open port **80** for HTTPS
• **Public Endpoint:** Click the drop-down arrow and select the container name specified above.
• **Identify your service:** Provide a unique name for your container service and click on Create container service. 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q8cjavkph06u5k8vm0ye.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q1ifppzify1w0s2v7a6q.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l2r4x815m75qq4gb0ak1.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ztjbbe95mgmsw9yzl9gl.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jc8b2qpp3yara36stzyq.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z5kqwkkzvvuax48iaxx6.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q5m3913cx6jqrlvmu81p.png)

**Step 3: Container service deployment and Testing.**
• Deployment currently ongoing and it might take some time. 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/37djde03fmov1m1mpdtn.png)

• Deployment completed and service in the running state.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vo99745obzr9ldsae6gr.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uklon48h3m1c32fdk5wg.png)
• **Testing**
Copy and paste the public domain on your web browser to access the application.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/trzpb5la6c4i91s4eka9.png)

If everything is done perfectly, your website will appear as shown below. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zizaqkn6e28rxx8ywqgz.png)


**Step 4: Clean Up**
You can easily delete the running service from the Amazon Lightsail console. It is a best practice to delete services that you are no longer in use so that you don’t keep getting charged for them. Note that if you stop a service in Amazon Ligthsail, you will still get charged. So, **DELETE!!!**

• Go back to the Amazon Lightsail console. Select the service, click on the 3 dots by the right and then click on delete.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uk7xk4ly89uocgil1dgi.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mr8t0irhqgn4323vu771.png)

**Conclusion**
Congratulations! You have used Amazon Lightsail to deploy a containerized e-commerce website.