Skip to Content
Technical Articles
Author's profile photo Enric Castella Gonzalez

Activate and use the FaaS service in Cloud Foundry for dummies

Hello!

Today I will show you a few simple steps to activate the FaaS services in cloud foundry so you can use the as a service functions.

Before starting, this video will give you a context

Let’s go!

 

Create a beta subacount

We must create a new subaccount in CF with the active beta functions, for this we follow these steps

  • Let’s go to our SAP Cloud Platform Fondry account
  • we will create a new subaccount and mark the option “beta features”
  • Once the subaccount is created we will enable the cloud fondry environment

  • After this step we will create a new space in this subacount

Activate subscription FaaS and create a new instance

  • We return to the subaccount and go to the Entitlements option

  • Press the “Edit” button and look for the Function section and add as many units as we need

Now we will activate the FaaS subscription

  • At the subaccount level we go to Subscriptions and select Functions

  • In functions, we subscribe the service with the Subscribe button

We have left to create the instance

  • To create the instance we will access the new Space created and in the Service Marketplace option we will select the option “Functions
  • We will create the new instance as indicated in the following image (special attention to the parameters) and as a name for example “faasfunction”

 

Create and assing role collection

  • At the Subaccount level we go to Role Collection and create a new Role Collection with the roles of the functions
  • We add to our user the necessary roles. We go to the trust configuration option and select the credential server, in this case SAP ID Service

  • There we add our user (mail) and select the role we have created

 

Creating the function with webIDE

We will use the WEBIDE template that will accelerate the construction

  • First we enable the Functions extension in WEBIDE
  • Once activated, we access WEBIDE and go to the top menu and select: File> New> Project from Template, select the option “Function MTA project (Beta)”
  • We add the data requested by the wizard, here I add the data that I have used
  • We have already created a new FaaS instance in the previous steps so we will use the instance already created. We will modify the MTA file so that when deploying we use the same instance

  • We have to build on the project and deploy like any project in CF. Here you can have a bug in the deploy, but the project is deployed correctly

 

Registration of the service function

We only have to register the deployed function and make an execution test.

  • we go to the service that we have subscribed at the subaccount level and select in “Go to Application”

  • We will see that our first function is already prepared
  • From “Functions” we can modify the function we have created, remember to save and deploy
  • From “triggers” we can call the function service to see the result
  • And this is the result of running the url

 

As you can see it is very easy to prepare useful functions to be used in any application, if you want to expand information here you have the official guide

https://help.sap.com/viewer/94fafb5bcf8f4c5cbdd0cdd8e358183c/Cloud/en-US/3418355e1497473baf071e28294dde41.html

Best regards

Assigned Tags

      3 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Pieter Janssens
      Pieter Janssens

      Thanks for the blog. I followed it, but I am stuck in the deploy step.

      Author's profile photo Wolfgang Röckelein
      Wolfgang Röckelein

      Hi Enric Castella Gonzalez ,

      thanks for the helpful blog.

      Do you know how to log from a faas instance to the logging service?

      Regards,

      Wolfgang

      Author's profile photo Dileep Kosana
      Dileep Kosana

      Hi All,

      I was getting below error when creating Instance for functions(Faas). Please suggest.