Splitting Traffic between Multiple versions in App Engine | Scribe

    Splitting Traffic between Multiple versions in App Engine

    • Hafeez Baig |
    • 12 steps |
    • 48 seconds
    alert ordinal icon
    Please review the previous lab on creating an App Service and Versions before proceeding with this lab.<https://scribehow.com/shared/Exploring_App_Engine_in_GCP__App_Services_and_Versions__ULQ6RRmpSlSfNX7d92ogvg>
    1
    Open the **Cloud Shell Editor**, click on the **main.py** from the left bar and change the "**V2**" to "**V3**" on the line 7 **Note:** This is to check the traffic for the V3
    2
    On the **Cloud Shell CLI** type [[gcloud app deploy --version=v3 --no promote]]
    information ordinal icon
    **What is command [[gcloud app deploy --version=v3 --no promote]]?**\ \ The command `gcloud app deploy --version=v3 --no-promote` deploys the app to Google App Engine with the specified version `v3` without routing traffic to the new version immediately.
    3
    Type "**Y**" to continue deployment process
    4
    Click on the link [[https://v3-dot-white-codex-429919-u6.uc.r.appspot.com]] **Note:** The link will differ for you since each app service has a unique URL.
    5
    **My Default Service - V3** is displayed in the new tab
    information ordinal icon
    Congratulations you have successfully deployed gcloud app
    6
    On the **Cloud Shell CLI**, type the command [[gcloud app services set-traffic --splits=v3=1]]
    information ordinal icon
    **What is command** [[gcloud app services set-traffic --splits=v3=1]]**?**\ \ The command `gcloud app services set-traffic --splits=v3=1` directs 100% of the traffic to version `v3` of an App Engine service. This is used to manage traffic distribution among different service versions in Google Cloud Platform.
    7
    Type "**Y**" to continue Traffic split for service process
    8
    Successfully completed Setting traffic split for service
    9
    Go back to the **deployment V2** tab and copy the URL
    10
    On the **Cloud Shell CLI,** type the command [[watch curl &lt;PASTE THE URL&gt;]]
    information ordinal icon
    **What is command [[watch curl https://white-codex-429919-u6.uc.r.appsspot.com/]]?**\ \ The command `watch curl https://white-codex-429919-u6.uc.r.appspot.com/` repeatedly sends HTTP requests to the specified URL and displays the response. It allows you to monitor the output of the URL in real time.
    11
    The **My Default Service -V2** is displayed, here you can see that the traffic is split to V2
    12
    After sometime **My Default Service -V3** is displayed because now the traffic is split to V3
    information ordinal icon
    Congratulations on completing this lab and Understanding Splitting Traffic between Multiple versions in App Engine