Skip to main content

Migrating AWS Lambda Functions to E2E

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

Steps to Migrate

  1. Clone the Repository

    First, the user needs to clone the repository using the Git Clone command.

    Migration Function 1 Migration Function 2

  2. Accessing the Function Locally

    After cloning, the Function and its supporting files can be accessed locally. Their listing would look like this.

    Migration Function 3

  3. Create the Workflows Directory

    Inside the same directory, create the .github/workflows directory using the command:

    mkdir -p .github/workflows
    mkdir -p .github/workflows
  1. Create the deploy.yml File

    Create a file with the name deploy.yml under the workflows folder using the command:

    touch .github/workflows/deploy.yml
  2. Download the YAML File

    Download this YAML file from here. Copy its content and paste it inside the deploy.yml file.

    Migration Function 5
    Migration Function 6

  3. Rename the Function File

    Change your function file name from lambda_function.py to code.txt.

    Migration Function 7
    Migration Function 8

  4. Change the Entry-Level Function Name

    Change the entry-level function name from def lambda_handler to def handler.

    Migration Function 9
    Migration Function 10

  5. Modify the deploy.yml File

    Make changes in the deploy.yml file:

    • Change the branch name to the one 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, and the runtime must correspond to the supported language choices.

    Migration Function 11

  6. Commit the Changes

    Migration Function 12

  7. Create the Function Using E2E CLI

    Use the E2E CLI command line tool to create the function. If the E2E CLI tool is not installed, please refer to the documentation for installation instructions.

    Migration Function 13

  8. Generate API Key and Auth Token

    On GitHub, go to the repository’s settings tab. Navigate to Security > Secrets and variables > Actions.

  9. In case you need to generate a new API key and Auth Token, please refer to the Documentation.

    Migration Function 14
    Migration Function 15

  10. Create Repository Secrets

    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 the API key generated from MyAccount as the value for this secret.
    • E2E_AUTH_TOKEN: Use the Auth Token generated from MyAccount as the value for this secret.

    Migration Function 16
    Migration Function 17

  11. Push the Code

    Now push the code using the git push command.

  12. Check Workflow Execution

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

    Migration Function 18
    Migration Function 19