What is a shadow launch?
========================

Shadow launch means that you launch the new version but it not yet gets live traffic. The traffic of the old version gets 1:1 copied into the the new one and so you can measure the performance and results of the new function against the old one without influencing the live system.

Tried approach
==============

I already tried building something like that myself with a "Proxy" function that async calls the new function and dumps the results and sync calls the old one returning its results. 

The problem are side effects: If both functions do something e.g. in DynamoDB there could be an invalid state in the DB because of the shadow launch.

Goal
====

I want to test new code versions of a particular lambda function. 

Intended usage Example
======================

I have a function that calculates Fibbonacci [recursive](https://gist.github.com/meghakrishnamurthy/331bd9addab3dbb1b6a23802b1c6845e#file-fibonacci-java-L43-L48) and stores the result with a timestamp in DynamoDB in my live system. 

This function is called via [AWS Step Functions](https://aws.amazon.com/step-functions/) as one in a chain of many.

As it should be more efficient to calculate it [iterative](https://gist.github.com/meghakrishnamurthy/331bd9addab3dbb1b6a23802b1c6845e#file-fibonacci-java-L20-L33) I implement the function with this new algorithm. 

Now I want to test the assumption that the new function is more performant than the old one.
So I shadow deploy it AWS lambda to get the actually live traffic as testing data.

Problem
-------

With the current tooling I found it is only possible to execute the function twice and thereby create two entries in DynamoDB which I consider an unwanted side effect as my data in the DynamoDB is in an unintended invalid state.

If I mock the external services in the new function, it may always be more performant than the old one as the time-expensive external services are not access and thereby my result would be incorrect.

Question
========

Is it possible to shadow launch a new version of an AWS lambda function without these side effects?