Containers on AWS — Amazon Lightsail Containers
Tags: aws, cloud, lightsail, containers
Published: 2023-03-13 06:27:15

![Amazon Lightsail](https://cdn-images-1.medium.com/max/2000/1*H-RTksm-whQEHdxibxPAYQ.png)

Hello everyone. I am Budi. I want to write about [Amazon LightSail](https://aws.amazon.com/lightsail). **Amazon LightSail** is an AWS service that can build application and website with low-cost and predictable price. Amazon LightSail has several features like instance, database, storage, networking, container and snapshot.

For this tutorial, I explain about LightSail container and deploy container using **Amazon ECR**.

Go to Compute section, choose **LightSail** and automatically open to new tab because the LightSail website is difference from the AWS console. Then choose Containers and click **Create container service.**

![LightSail website.](https://cdn-images-1.medium.com/max/2000/1*xxIBrXwWMrOxSg8Fcq_ZSQ.jpeg)

You can change the AWS region with click **Change AWS region**. Use North Virginia (us-east-1) for deploying ECR private on LightSail.

![](https://cdn-images-1.medium.com/max/2000/1*5MncOC9zFrAVohZu_KkcsA.jpeg)

Choose container service capacity based on memory, vCPU and cost. The price is **predictable**. Also, can want how many capacity needs.

![](https://cdn-images-1.medium.com/max/2000/1*0weisdUs5NigUxUuoQ5uHQ.jpeg)

The deployment section doesn’t need it for now but needs it later. Fill in the service name and get a domain for the container service. You can see the summary and click **Create container service** for the next step.

![](https://cdn-images-1.medium.com/max/2000/1*RyY0AX6Dw8h1YB-ID_JnSQ.jpeg)

![](https://cdn-images-1.medium.com/max/2000/1*9nO3iuhBeda59WbSl_miuw.jpeg)

The container service status is pending. This means the LightSail container prepare infrastructure and when the status is running, the domain can be accessed.

![](https://cdn-images-1.medium.com/max/2000/1*JgaCA43JeIUJ9bRO_pPLwQ.jpeg)

Now, LightSail can add ECR private image based on [the link](https://aws.amazon.com/about-aws/whats-new/2022/05/amazon-lightsail-containers-deploying-images-amazon-ecr-private-repositories/). Amazon LightSail containers now support deploying images from Amazon ECR private repositories. Before LightSail can add ECR private image, LightSail can add ECR public and Docker Hub only. Click the **Images** section.

![](https://cdn-images-1.medium.com/max/2000/1*5W79sSi2QHkUaJJDe_T2vA.jpeg)

Scroll down until see **Amazon ECR private repositories**. Then click **Add repository**.

![](https://cdn-images-1.medium.com/max/2000/1*no27U8M3f9VoHtUAUPvYkA.jpeg)

Because I has one ECR private image on North Virginia, automatically show and choose the ECR private image. Click **Add.**

![](https://cdn-images-1.medium.com/max/2000/1*QmbtCp7z1LA68ourYM8RqA.jpeg)

If you can see this screenshot, you must go to ECR page for create permissions between ECR private and LightSail.

![](https://cdn-images-1.medium.com/max/2000/1*PapPgpCLjJbfYDd-AuhjZQ.jpeg)

Click blue bullet, click **Actions** then **Permissions**.

![](https://cdn-images-1.medium.com/max/2064/1*o-fiKWbIeqx_6uGNOXCk6g.jpeg)

Click **Edit policy JSON** and if finished, click **Save**. You see the left screenshot if the policy JSON is true with **ManageEcrPrivateRepositoriesAccess** name.

The right screenshot is when the deployment ECR private image is successful, automatically created ECR private image permissions **AllowLightsailPull-<yourcontainerservicename>**.

![](https://cdn-images-1.medium.com/max/2588/1*kixVUKFsVsIMwJRQnFTp6g.jpeg)

![LEFT SCREENSHOT AND RIGHT SCREENSHOT](https://cdn-images-1.medium.com/max/2554/1*zntLQeGWwPaxQSW77tE3Pw.jpeg)

If edit ECR private permissions are successful, the two requirements are valid then can click **Continue**. You can see the next step. Copy the URL image and click the **Deployments** section.

![](https://cdn-images-1.medium.com/max/2000/1*T3jHFTQSRaIbrPvdgYEQww.jpeg)

![LEFT: Click “Continue” | RIGHT: Next step.](https://cdn-images-1.medium.com/max/2000/1*-z17pINMN-duwfpQpoLWDQ.jpeg)

![](https://cdn-images-1.medium.com/max/2000/1*DoDpMKgqv_c_B7g80Qh7yA.jpeg)

Click **Create your first deployment**. Fill in the container name. For the image, paste the URL image when copying on the right screenshot. Click add open ports, fill in 8080 and HTTP.

![](https://cdn-images-1.medium.com/max/2000/1*A-lTduAoUSqgqY3WL8CpiQ.jpeg)

You can add container up to 10 containers in one deployment. Choose public endpoint and click **Save and deploy**. Waiting until ready.

![](https://cdn-images-1.medium.com/max/2000/1*ivPE4mtz3Qkumu1Z_d5-qQ.jpeg)

You have currently a deployment and deployment version. Currently deployment can modify/edit. If created new deployment, old version is inactive. When a deployment is active, it means the container service is running and the status is ready.

![](https://cdn-images-1.medium.com/max/2000/1*RN6Nt00btPB4aHZEu_vUqA.jpeg)

![](https://cdn-images-1.medium.com/max/2000/1*oVOaq2YOZIN7cOBePBQ7zQ.jpeg)

See again public domain and click the **public domain**.

![](https://cdn-images-1.medium.com/max/2000/1*5W79sSi2QHkUaJJDe_T2vA.jpeg)

Finally, the deployment is successful. I test the website and upload image. Left screenshot for can upload image. Right screenshot is show result the image.

![](https://cdn-images-1.medium.com/max/2718/1*KrzWfGkJqCdts3ZdY_5d3A.jpeg)

![](https://cdn-images-1.medium.com/max/2682/1*nLWUwX6TNtzrcw33Iyx40Q.jpeg)

Thank you all when you read this tutorial. I want to write about LightSail instances and databases. Thank you again!