Functions using E2E CLI

Introduction

The E2E CLI is a command-line tool developed by E2E Networks Ltd. It enables users to access and manage Functions directly from the command line.

E2E CLI Configuration and Setting up

E2E CLI

The E2E_CLI requires Python and PIP as pre-requisite for installation. To learn more about installing Python and PIP. click here. Open a terminal on your PC and execute the following command:

pip install e2e-cli

After successfully installing the E2E CLI, you should enter the following command in your terminal to add an alias:

e2e_cli alias add

After executing the command mentioned above, you will be prompted to provide your ‘API key’ and ‘Auth Token’ obtained from the E2E My Account portal. You can add any number of tokens on your system using the same command, ensuring that alias names are kept different. To know more kindly click on the link: Click Here

../_images/faas_addalias.png

Alternatively, you have the option to add tokens via a file downloaded from the My Account UI.

e2e_cli alias add_file
../_images/faas_addfile.png

Setup Functions using CLI

To create or launch a Functions using the CLI, execute the following command:

e2e_cli faas --name="<function_name>" --lang="python" setup
../_images/faas1.png

Listing all Functions using CLI

To list all your Functions using the CLI, use the following command:

e2e_cli faas list
../_images/faas_list.png

You may notice that your functions is in the deploying state, and it will take some time to transition into the running state.

e2e_cli faas list

Please run the command again to check the status.

../_images/faas_running.png

Deploying Functions using CLI

You can configure the memory and timeout settings for Functions using the following command:

e2e_cli faas --name="<function_name>" --lang="python" deploy --mem=128 --timeout=15
../_images/faas_memtime.png ../_images/faas_aftermem.png

Environment file Changes:

You can make changes in Environment file of your functions

Envorirement file be like

Example:

Qwert:tyuio
Sdfgh:rtyuio
Xcvbn:ghjkl

Use the following command to navigate to the directory test1-cli-1-py:

cd test1-cli-1-py
../_images/faas_req1.png

Then use ls command to list the files and directories in the current directory.

To edit the file environment_variable.txt using the vi command, execute the following:

vi environment_variable.txt

Please add the following code to the environment file and save it:

Qwert:tyuio
Sdfgh:rtyuio
Xcvbn:ghjkl
../_images/faas_req2.png

You can verify the changes made in the file by using the following command:

cat environment_variable.txt
../_images/faas_req3.png

Requirements file Changes

To make changes to the requirements file, you can directly add packages by following the steps mentioned above.

Update Functions using CLI

You can do the modification in the code by using following command:

cd test1-cli-1-py
vi test1-cli-1-py/code.txt

After making modifications to your functions, you can redeploy it using the following command.

e2e_cli faas --name="<function_name>" --lang="python" redeploy
../_images/faas_redeploy.png

Destroy your Functions

You can destroy/delete your functions using following command:

e2e_cli faas --name="<function_name>" --lang="python" destroy
../_images/faas_destroy.png

Check your Functions is deleted or not using following command:

e2e_cli faas list
../_images/faas_destroy1.png