Create Revision

Create Revision

  1. First, we add some glue code in the monolith to move the like function into a separate service (microservice). In the lab, use VSCode and find the app/monolith-service/service/mythicalMysfitsService.py file. Then uncomment the following code snippet:
# @app.route("/mysfits/<mysfit_id>/fulfill-like", methods=['POST'])
# def fulfillLikeMysfit(mysfit_id):
#     serviceResponse = mysfitsTableClient.likeMysfit(mysfit_id)
#     flaskResponse = Response(serviceResponse)
#     flaskResponse.headers["Content-Type"] = "application/json"
#     return flaskResponse

 Microservices with AWS Fargate

  1. With the new feature added to the monolith, we rebuild the monolith docker image with a new tag (nolike).
 cd ~/environment/amazon-ecs-mythicalmysfits-workshop/workshop-1/app/monolith-service
 MONO_ECR_REPOSITORY_URI=$(aws ecr describe-repositories | jq -r .repositories[].repositoryUri | grep mono)
 docker build -t monolith-service:nolike .

 Microservices with AWS Fargate

  1. Perform push of the monolith docker image to ECR
  • It’s best practice to avoid the latest tag, which can be ambiguous. Instead, choose a unique tag, descriptive name, or preferably a Git SHA and/or version ID).
 docker tag monolith-service:nolike $MONO_ECR_REPOSITORY_URI:nolike
 docker push $MONO_ECR_REPOSITORY_URI:nolike

 Microservices with AWS Fargate

  1. Check if the monolith docker image has been pushed to ECR.
  • Access ECS
  • Select Task Definitions
  • Select Monolith-Definitions-STACK_NAME (note that yours might look different in the picture because the latter part depends on the STACK_NAME you set)

 Microservices with AWS Fargate

  1. Then, select Monolith-Definition-STACK_NAME.
  • Select Create new revision

 Microservices with AWS Fargate

  1. Access ECR to view the repositories. Now, in the Images section, 2 images have appeared with 2 tags: latest and nolike.
  • Copy the Image URI

 Microservices with AWS Fargate

  1. Use the Image URI of the nolike tag to create a New revision
  • Perform Container configuration
  • Replace the Image URI with the Image URI of the nolike tag

 Microservices with AWS Fargate

  1. Select Create

 Microservices with AWS Fargate

  1. Successfully created Monolith-Definition-STACK_NAME revision 3.

 Microservices with AWS Fargate