Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS Lambda support #121

Open
deathquin opened this issue Jan 26, 2020 · 14 comments
Open

AWS Lambda support #121

deathquin opened this issue Jan 26, 2020 · 14 comments

Comments

@deathquin
Copy link

The directory was applied to the environment variable SAPNWRFC_HOME by following the installation instructions, but eventually it does not work. And here's the message.
In lambda, I put the file in the folder /var/task.
"The SAP NW RFC SDK could not be loaded"
I wonder if it can't be turned in aws lambda. I'd appreciate it if you could let me know.
Thank you

@Suncatcher
Copy link

Have you found any solution?

@bsrdjan
Copy link
Member

bsrdjan commented Mar 2, 2020

Where the ABAP backend system should be installed, to be reached from AWS Lambda?

@manishvyas1911
Copy link

Hi @bsrdjan please help with the above.
Is it possible to setup SDK so that it would be accessible to AWS Lambdas.

@bsrdjan
Copy link
Member

bsrdjan commented May 25, 2020

Basically you need to:

  1. Build the node-rfc from source on a same platform the AWS Lambdas are running on

  2. Deploy the node-rfc package, together with SAP NWRFC SDK on AWS Lambdas

The AWS Lambdas run on AMI Linux and you can build the node-rfc from source on AMI Linux based docker container for example. Also check with Linux 2, the AMI Linux successor: https://aws.amazon.com/amazon-linux-2/

After the node-rfc works in Amazon docker, the AWS Lambdas deployment package, containing NWRFC SDK, should be built, following: https://aws.amazon.com/premiumsupport/knowledge-center/lambda-linux-binary-package/

After deployment on AWS Lambda, the node-rfc should connect to some ABAP system from there and for that RFC connection parameters are required. That is why I asked where the ABAP system is running.

ABAP business systems are not exposed in internet and the connection from Cloud to ABAP, requires SAP Cloud Connector (SCC) component installed on premise. The NWRFC SDK is currently not enabled for using SCC channel and the feature request is the same like for the Cloud Foundry: @mkolksdorf#79.

@manishvyas1911
Copy link

hi @bsrdjan
Yes the system is connected to SAP Cloud Connector(SCC) and i am able to use it with nodejs application in EC2 instance. as i can configure easily all the requirements like as mentioned in node-rfc document. but i need to do it in lambdas only as it is cost efficient.
As guided by you, i used https://hub.docker.com/_/amazonlinux and setup node-rfc environment in it. now problem is how to deploy the node-rfc package, together with SAP NWRFC SDK on AWS Lambdas. please help
err

@manishvyas1911
Copy link

The directory was applied to the environment variable SAPNWRFC_HOME by following the installation instructions, but eventually it does not work. And here's the message.
In lambda, I put the file in the folder /var/task.
"The SAP NW RFC SDK could not be loaded"
I wonder if it can't be turned in aws lambda. I'd appreciate it if you could let me know.
Thank you

Did u find any solution?

@bsrdjan
Copy link
Member

bsrdjan commented Jun 6, 2020

Solving the loading issue would lead to the next problem, I mentioned at the end of my previous comment. The NWRFC SDK is currently not enabled for using SAP Cloud Connector Channel and even if loaded, it can't use the SCC to reach ABAP backend system.

The same feature request can be created, like for the Cloud Foundry: node-rfc/#79.

@manishvyas1911
Copy link

manishvyas1911 commented Jun 6, 2020

So is it not at all possible. I was able to call sap functions with nodejs app with SDK configured inside EC2 instance. Just need to check if possible with lambdas

@manishvyas1911
Copy link

manishvyas1911 commented Jun 8, 2020

Hi @bsrdjan , I finally figured out a way to get this done. First of all let me get you through issues.

#Issue : Error: /var/task/node_modules/node-rfc/lib/binding/sapnwrfc.node: invalid ELF header
Solved: Created Node modules.

#Issue: Error: libsapnwrfc.so: cannot open shared object file: No such file or directory
Solved: Copy nwrfcsdk libraries in lib folder and zip with code.

#Issue: Not able to load libraries from lib folder.
Solved: Lambda has LD_LIBRARY_PATH set to /var/task/lib where I was putting the libraries in /var/task/libs

#Issue: Error: libuuid.so.1: cannot open shared object file: No such file or directory
Solved:

  1. AWS Lambda uses the amzn2-ami-hvm-2.0.20190313-x86_64-gp2
  2. Linux study gives: lib, lib64 folder may contain system libraries.
  3. get all the files required from amazon linux docker.
  4. paste it inside lib folder.

Steps to get it done.

  1. Create a layer in aws lambda with node-rfc modules.
    - ref link: https://epsagon.com/blog/aws-lambda-layers-getting-started-guide/
  2. Create a folder named "lib" and add all nwrfcsdk lib files inside it.
  3. Pull Amazon Linux docker and go to Lib64 folder . basically you need to copy three files in your
    "lib" folder i.e. libuuid.so.1, libmount.so.1, libblkid.so.1
    image
  4. Create a lambda function with lambda credentials i.e index.js and zip it together with "lib" folder.
  5. Upload lambda with aws as
    • aws lambda update-function-code --function-name my-function --zip-file fileb://function.zip
    • directly through console.
  6. In aws lambda set environment variable as LD_LIBRARY_PATH : /var/task/lib

Thats all. All above issues will be resolved and SDK problem is also solved.
To see demo : https://www.youtube.com/watch?v=rhY4jVtl0k8&t=39s

@bsrdjan bsrdjan closed this as completed Sep 3, 2020
@bsrdjan
Copy link
Member

bsrdjan commented Nov 3, 2020

The feature request to enable SAP NWRFC SDK usage on AWS Lambda, in Connectivity context, can be created for:

Security Services category of the SAP Cloud Platform – Platform Foundation

@bsrdjan bsrdjan reopened this Nov 3, 2020
@bsrdjan bsrdjan changed the title I want to use the library in aws lambda AWS Lambda support Nov 3, 2020
@bsrdjan
Copy link
Member

bsrdjan commented Feb 18, 2021

You may vote for the new request, linked here: #145 (comment)

@frumania
Copy link

frumania commented Dec 27, 2021

Thanks to @manishvyas1911 research, this is actually even easier to do.

We have created a simple walkthrough to setup your AWS Lambda Project for Node RFC.

@mtolksdorf
Copy link

@frumania: The connection parameters are not visible. How do you connect to the ABAP system? What are the prerequisites so that the system can be reached? In case it needs to be exposed to the internet, using SNC is mandatory and this is not visible in the simple walk-through, neither for node nor for the described alternative using JCo within a Java runtime. Neither node nor Java in a lambda environment can make use of a Cloud Connector setup

@frumania
Copy link

frumania commented Jan 4, 2022

Thanks for the reply!

Connectivity:
I am simply using the sapnwrfc.ini adjusted to my SAP system running on AWS (private IP), straight forward. Similarly you can connect to an OnPremise system via VPN or DIrect Connect (all private connections) through private IP-Address or DNS. As a prerequisite you deploy the Lambda function inside your own VPC = private connection, hence also the Security Group and Subnet snippet for the AWS SAM template.
SAP Cloud Connector is for SAP BTP connectivity only and not applicable/nor useful in this case.

SNC:
This can be done as per documentation, just add the applicable libsapcrypto.so to the lib folder and adjust sapnwrfc.ini.

Happy to support, if you have a specifc setup!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants