Skip to content

Instantly share code, notes, and snippets.

@adhorn
Created July 22, 2018 23:21
Show Gist options
  • Select an option

  • Save adhorn/60c7abdbe0792d8732a8661b0837f278 to your computer and use it in GitHub Desktop.

Select an option

Save adhorn/60c7abdbe0792d8732a8661b0837f278 to your computer and use it in GitHub Desktop.
Traffic shifting with Lambda Alias
Traffic Shifting Using an Alias (CLI)
To configure an alias to shift traffic between two function versions based on weights.
Here is an example that points an alias to two different Lambda function versions, starting with version 1 receiving 90% and version 2 receiving 10%
> aws lambda create-alias --name myalias --function-name myfunction --function-version 1 --routing-config AdditionalVersionWeights={"2"=0.1}
Then you can update the percentage of incoming traffic to version 2, here to 15%.
> aws lambda update-alias --name myalias --function-name myfunction --routing-config AdditionalVersionWeights={"2"=0.15}
Eventually, after several cycle of incremental increase, you can route all traffic to version 2 by changing the function-version property to point to version 2 and set the routing-config parameter to an empty string, as shown following.
> aws lambda update-alias --name myalias --function-name myfunction --function-version 2 --routing-config ''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment