Create traffic routes

We will try sending 33% of the traffic over to our canary. If our monitoring indicates that the service is healthy, we could start granualy increasing the load with automated rollouts (and rollback if issues are indicated), but we’re keeping things simple for the workshop. In order to do so, we will create a second route in the existing virtual router. The new route will have a higher priority (lower number) and the same match condition as the existing one. The net effect is the new route will be evaluated and selected over the existing one.

  • Start shifting traffic to your canary virtual node. Traffic will be distributed between the crystal-sd-vanilla and crystal-sd-epoch virtual nodes at a 2:1 ratio respectively.
# Define variables #
SPEC=$(cat <<-EOF
  { 
    "httpRoute": {
      "action": { 
        "weightedTargets": [
          {
            "virtualNode": "crystal-sd-vanilla",
            "weight": 2
          },
          {
            "virtualNode": "crystal-sd-epoch",
            "weight": 1
          }
        ]
      },
      "match": {
        "prefix": "/"
      }
    },
    "priority": 5
  }
EOF
); \
# Create app mesh route #
aws appmesh create-route \
  --mesh-name appmesh-workshop \
  --virtual-router-name crystal-router \
  --route-name crystal-random-route \
  --spec "$SPEC"