Gluon CloudLink provides the means through which enterprise developers can enable mobile apps to interact with their back end infrastructure through the use of remote functions. Until now, a remote function could only call into a HTTP REST endpoint, however today the Gluon engineering team is pleased to announce that developers can now configure a remote function to invoke an Amazon AWS Lambda function.
AWS Lambda is a serverless compute service that runs your code in response to events and automatically manages the underlying compute resources for you. You can use AWS Lambda to extend other AWS services with custom logic, or create your own back-end services that operate at AWS scale, performance, and security. This lets you run code without the need for provisioning and managing servers. The infrastructure and runtime environment is completely taken care of by AWS Lambda. In other words, you no longer need to deal with the hassle of setting up, configuring, and maintaining your infrastructure, e.g. Amazon EC2 instances. You only write your code, deploy it into an AWS Lambda function and invoke the function. You only pay for the compute time that is consumed while your function is running.
From the mobile application’s point of view, there is no difference in calling a CloudLink remote function that is configured to invoke a HTTP REST endpoint or an AWS Lambda function. The API on the client remains the same. While in theory it is possible to directly call the AWS Lambda function from within the mobile application code, there are a number of reasons why it is recommended to use a bridging component like Gluon CloudLink. With Gluon CloudLink, the access control to the AWS Lambda function is managed inside Gluon CloudLink. The AWS credentials are not stored on mobile devices, but are maintained in Gluon CloudLink. Also, the Gluon CloudLink administration tools allow for flexible workflow management. In case you want to replace an existing AWS Lambda function with a new one, or you want to change some of the parameters, you can easily do that using the Gluon Dashboard, without the need to redeploy your mobile app to all users.
One of the major issues with mobile applications is that once they are shipped to the App Store or the Play Store, you can’t control their lifecycle. You can not simply provide a hotfix for your mobile app, and hope that all installed applications will update immediately. First of all, it may take days before the new version of your application is approved by the stores, and second, even when a new version is released in the stores, it may take days or longer before users upgrade to that version, if they ever do. This can lead to disasters, if an application ships with a link to a remote function (e.g. an AWS Lambda function) that is no longer active or correct.
Gluon Dashboard, and the Gluon CloudLink SDK, on the other hand, are continuously available to you. If you change a configuration in Gluon CloudLink, it will be immediately valid and used by all mobile users. Thanks to the decoupling of the remote function and the external functionality, you can quickly modify the binding between the two. In case you want to point a specific remote function to a new AWS Lambda function, this can be realised in a few seconds.
As an example of calling a remote function in Gluon CloudLink which is backed by AWS Lambda, the code below calls a remote function by passing in a single parameter and a raw array of bytes. The client is unaware of the actual implementation that is chosen for the remote function.
RemoteFunction storeAudio = RemoteFunctionBuilder.create("storeAudio")
GluonObservableObject<String> response = DataProvider.retrieveObject(dataClient.createObjectDataReader(storeAudio, String.class));
When a Gluon CloudLink remote function is called, Gluon CloudLink in turn invokes the linked AWS Lambda function. The lambda function can provide a response in the callback, which is propagated all the way back to the mobile application. In the snippet above, the response will be read into a plain string object.
More information about integrating AWS Lambda functions in Gluon CloudLink can be read in the CloudLink documentation. We also provide an end-to-end tutorial that demonstrates how a Gluon Mobile application uploads a recorded audio file to an Amazon S3 bucket through the use of a CloudLink Remote Function that is linked with an AWS Lambda function. The sample code for the mobile application itself can be found in our Gluon Samples Github repository.
Gluon CloudLink is ready today for production deployments. Our customers benefit from it in myriad ways, and our focus on continuing innovation means that customers are continuing to gain additional benefits in every Gluon CloudLink release. You can try Gluon CloudLink for free today.