Migrating AWS Lambda Functions to E2E

Consider an example where the AWS lambda function is already available on a GitHub repository.

  1. First of all the user needs to clone the repository using the Git Clone command.

../_images/Migration_Function1.png ../_images/Migration_Function2.png
  1. After cloning, the Function and its supporting files can be accessed locally. Their listing would look like this.

../_images/Migration_Function3.png
  1. Inside the same directory, create .github/workflows directory using the command

mkdir -p .github/workflows
../_images/Migration_Function4.png
  1. Create a file with the name deploy.yml under the workflows folder using the command

touch .github/workflows/deploy.yml
../_images/Migration_Function5.png
  1. Download this yaml file using link. Copy its content and paste it inside the deploy.yml file.

../_images/Migration_Function6.png
  1. Change your function file name from lambda_function.py to code.txt.

../_images/Migration_Function7.png ../_images/Migration_Function8.png
  1. Change the entry-level function name from def lambda_handler to def handler.

../_images/Migration_Function9.png ../_images/Migration_Function10.png
  1. Make changes in the deploy.yml file.

    • Change the branch name. The branch from which you want to trigger the automatic deployment.

    • Change the function name and runtime. The function name should be the same as the repository name. The runtime must be the one according to the supported language choices.

../_images/Migration_Function11.png
  1. Commit the changes.

../_images/Migration_Function12.png
  1. Create the function using the e2e-cli command line tool. If e2e-cli tool is not installed, please refer to the documentation and install it.

../_images/Migration_Function13.png
  1. On GitHub, go to the repository’s settings tab. Navigate to Security > Secrets and variables > Actions

  2. In case of generating a new API key and Auth-Token please refer to the Documentation.

../_images/Migration_Function14.png ../_images/Migration_Function15.png
  1. Navigate to the Repository Secrets section and create new secrets by clicking the New Repository Secret button. Create the following two secrets:

    • E2E_API_KEY: Use apikey generated from MyAccount as the value for this secret.

    • E2E_AUTH_TOKEN: Use the authtoken generated from MyAccount as the value for this secret.

../_images/Migration_Function16.png ../_images/Migration_Function17.png
  1. Now push the code using the git push command.

  2. On GitHub navigate to the Actions > All workflows. You will see a workflow under execution. Once it is executed successfully, the Function will be redeployed. Same you can check on the MyAccount cloud console.

../_images/Migration_Function18.png ../_images/Migration_Function19.png