Monday, February 1, 2021

Deployment of SpringBoot Services on AWS Elastic Container Services: Part 1 AWS ECR (Amazon Elastic Container Registry (ECR)

Deployment of SpringBoot Services on AWS Elastic Container Services:  Part 1 AWS ECR (Amazon Elastic Container Registry (ECR) 

Amazon Elastic Container Registry (ECR) is a fully managed container registry that makes it easy to store, manage, share, and deploy your container images and artifacts anywhere. Amazon ECR eliminates the need to operate your own container repositories or worry about scaling the underlying infrastructure. Amazon ECR hosts your images in a highly available and high-performance architecture, allowing you to reliably deploy images for your container applications.


This thread, Part 1 discusses the provisioning of AWS ECR:

Create the repository:

  • Navigate to the Amazon ECR console.
  • On the Repositories page, select Create Repository.
  • On the Create repository page, enter the following name for your repository: api.
    ⚐ Note: Under Tag immutability, leave the default settings.
  • Select Create repository.


After the repository is created, you receive a confirmation message and the repository address is listed under URI. The repository address is in the following format: [account-ID].dkr.ecr.[region].amazonaws.com/[repo-name]. The [account-ID][region], and [repo-name] will be specific to your setup.


ECR





























Build and Push Docker Image to ECR

Using AWS Client Login, Log into the repository.

Use the terminal to authenticate Docker log in:

  1. Run one of the following commands, depending on which version of AWS CLI you have (To identify the version, run aws --version. If needed, configure your credentials.):
    • If you have AWS CLI version 1.x, then run:
      $(aws ecr get-login --no-include-email --region [your-region])
      Replace [your-region], for example: $(aws ecr get-login --no-include-email --region us-west-2)
    • If you have AWS CLI version 2.x, then run:
      aws ecr get-login-password --region [your-region] | docker login --username AWS --password-stdin [your-AWS-account-ID].dkr.ecr.[your-region].amazonaws.com
      Replace [your-region] and [your-AWS-account-ID], for example: aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin 123456789012.dkr.ecr.us-west-2.amazonaws.com
      If authentication is successful, you will receive the confirmation message: Login Succeeded.














  • To build the image, run the following command in the terminal: 
docker build -t api .




  • After the build completes, tag the image so you can push it to the repository: 

docker tag api:latest [account-ID].dkr.ecr.[region].amazonaws.com/api:v1 





  • Push the image to Amazon ECR by running: 

docker push [account-id].dkr.ecr.[region].amazonaws.com/api:v1














If you navigate to your Amazon ECR repository, you should see your image tagged v1.




Amazon Bedrock and AWS Rekognition comparison for Image Recognition

 Both Amazon Bedrock and AWS Rekognition are services provided by AWS, but they cater to different use cases, especially when it comes to ...