Create Revision
Create Revision
- In the First step, we add some glue code in monolith to turn the like function into a separate service (microservice). In the lab, use Cloud9 and find the app/monolith-service/service/mythicalMysfitsService.py file. Then do uncomment the following code:
# @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

- With the new feature added 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 .

- Execute push monolith docker image onto ECR
- It is best 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

- Check whether the monolith docker image has been pushed to the ECR?
- Access to ECS
- Select Task Definitions
- Select Monolith-Definitions-STACK_NAME (save you may be different in the picture because the following part depends on the STACK_NAME you set)

- Then select Monolith-Definition-STACK_NAME revision 2.
- Select Create new revision

- Go to ECR to view the repositories. Now, in the Images section, there are 2 images with 2 tags: latest and nolike.

- Use Image URI tag nolike to create New revision
- Configure Container
- Replace Image URI with Image URI tag nolike

- Select Create

- Finish creating Monolith-Definition-STACK_NAME revision 3.
