Create Revision
Create Revision
- 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

- 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 .

- 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

- 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)

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

- Access ECR to view the repositories. Now, in the Images section, 2 images have appeared with 2 tags: latest and nolike.

- 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

- Select Create

- Successfully created Monolith-Definition-STACK_NAME revision 3.
