DEV Community

Budiono Santoso for AWS Community Builders

Posted on • Edited on

Containers on AWS — Amazon Elastic Container Registry (ECR) and AWS App Runner

Architecture

Hello before, I am Budi. I write about AWS App Runner with Amazon ECR services. If you want to read about AWS App Runner with GitHub, you can see the page. Amazon ECR is an AWS service that fully managed container registry that can store, share and deploy your containers.

Let’s go! Before starting, (optional) you can use AWS Cloud9 by Amazon EC2 for IDE.

Go to AWS Cloud9 and click Create environment.

AWS Cloud9

Then, fill in the name and description, click Next step.

Choose environment type and also instance type for IDE.

Choose platform, cost-saving setting. Create IAM role for AWS Cloud9 and click Next step.

Then, you can check again before click create environment for IDE. If already, can click Create environment.

LOADING FOR CLOUD9 ENVIRONMENT

Then go to Amazon ECR service. Click private for private repository and click Create repository.

Fill in the repository name and click Create repository.

Now my Amazon ECR has one private repository and now can store Docker image. Go to AWS Cloud9 and the environment is ready to deploy the Docker image to Amazon ECR.

CLICK BULLET AND CLICK VIEW PUSH COMMANDS

Before push commands for the private repo, git clone from GitHub for can store/deploy image. Then click view push commands to see the step push Docker image to firstecr repository. Copy command number 1 until 4.

git clone https://github.com/budionosan/serverlesshackathon.git

cd serverlesshackathon

aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin <YOUR_AWS_ACCOUNT_ID>.dkr.ecr.us-east-1.amazonaws.com

docker build -t firstecr .

docker tag firstecr:latest <YOUR_AWS_ACCOUNT_ID>.dkr.ecr.us-east-1.amazonaws.com/firstecr:latest

docker push <YOUR_AWS_ACCOUNT_ID>.dkr.ecr.us-east-1.amazonaws.com/firstecr:latest
Enter fullscreen mode Exit fullscreen mode

VIEW PUSH COMMANDS

Step 1

Step 2

After the process is finished, the image is successful push and can use for Amazon ECS (next tutorial), Amazon EKS (next tutorial) and AWS App Runner (this tutorial).

Next, go to AWS App Runner service and click create service.

AWS App Runner

Choose container registry, choose Amazon ECR (not Amazon ECR Public) and browse container image URL from Amazon ECR.

Container image URL.

You can choose deployment settings. Manual using App Runner console or CLI. Automatic means when Amazon ECR has a new version can automatically deploy to AWS App Runner. Create also IAM role for App Runner and click Next.

Fill in the service name, virtual CPU and memory, port (8080)

THIS OPTIONAL (CAN EDITED)

CLICK NEXT

You can review scrolling to bottom and click Create & deploy if matching.

Wait for loading the progress in AWS App Runner. This service has a default domain and source from Amazon ECR. The domain can be changed.

PROGRESS

After the progress is finished, your App Runner service is ready. Click default domain.

SUCCESSFUL

LEFT — Web application from ECR image | RIGHT — Event log.

Services:

Create web application with App Runner are easy. Thank you very much :)

Top comments (0)