Lambda Language Support in the Cloud Gem Framework - Lumberyard User Guide

Lambda Language Support in the Cloud Gem Framework

Open 3D Engine (O3DE), the successor to Lumberyard, is now available in Developer Preview. Download O3DE or visit the AWS Game Tech blog to learn more.

Lumberyard has support for Lambda deployment packages that include Lambda functions written in Node.js, Python 3.7 or later, Java, Go, or the .NET framework.

To add a non-Python Lambda function to a cloud gem

  1. Add a new Lambda function and Lambda configuration to the Resources block of your resource_template.json file.

    The following example shows the entries for the .NET Lambda function in the resource_template.json file of the AWS Lambda Language Demo cloud gem.

    [ … ] "Resources": { "AccessControl": { "DependsOn": [ "PythonLambda", "JavaJarLambda", "DotnetLambda", "GoLambda", "NodeLambda" ], "Properties": { "ConfigurationBucket": { "Ref": "ConfigurationBucket" }, "ConfigurationKey": { "Ref": "ConfigurationKey" }, "ServiceToken": { "Ref": "ProjectResourceHandler" } }, "Type": "Custom::AccessControl" }, [ … ] "DotnetLambda": { "Properties": { "Code": { "S3Bucket": { "Fn::GetAtt": [ "DotnetLambdaConfiguration", "ConfigurationBucket" ] }, "S3Key": { "Fn::GetAtt": [ "DotnetLambdaConfiguration", "ConfigurationKey" ] } }, "Handler": "DotnetLambda::DotnetLambda.Function::FunctionHandler", "Role": { "Fn::GetAtt": [ "DotnetLambdaConfiguration", "Role" ] }, "Environment": { "Variables": { "Fn::GetAtt": [ "DotnetLambdaConfiguration", "CCSettings" ] } }, "Runtime": { "Fn::GetAtt": [ "DotnetLambdaConfiguration", "Runtime" ] } }, "Type": "AWS::Lambda::Function" }, "DotnetLambdaConfiguration": { "Properties": { "ConfigurationBucket": { "Ref": "ConfigurationBucket" }, "ConfigurationKey": { "Ref": "ConfigurationKey" }, "FunctionName": "DotnetLambda", "Runtime": "dotnetcore1.0", "ServiceToken": { "Ref": "ProjectResourceHandler" } }, "Type": "Custom::LambdaConfiguration" }, [ … ]
  2. Follow the instructions in Creating a Deployment Package to create a Lambda function deployment package for the runtime that you are using.

  3. Use the FunctionName property of the function's LambdaConfiguration section to name the packaged .zip or .jar file.

  4. Put the package file (for example, in the lumberyard_version\dev\Gems\gem_directory\vN\AWS\lambda-code\ directory.


When you create non-Python Lambda functions for use with Cloud Canvas, note the following:

  • The Visual Studio tools for .NET Lambda functions do not generate a Lambda function deployment package automatically. For steps, see .NET Core CLI in the AWS Lambda Developer Guide.

  • When you use the Eclipse IDE and Apache Maven to build a Java .jar package, Maven generates a .jar file named project-SNAPSHOT.jar. The Cloud Canvas uploader supports this naming convention and the project.jar file.

  • Each runtime has its own format for the Handler property. See the following table.

    Language Handler Property

    class must implement the RequestHandle class.

    Go The name of the executable generated by the go build command.

Examples and Sample Level

The AWS Lambda Language Demo cloud gem included with Lumberyard contains skeleton "Hello World" Lambda function examples in Python, Java, .NET, Go, and node.js. You can find the relevant files in the lumberyard_version\dev\Gems\AWSLambdaLanguageDemo\v1\AWS\lambda-code directory.

Running the Sample Level

The CloudGemSamples project cloud gem includes a sample level named LambdaLanguage that shows Cloud Canvas support for Lambda languages.


Running the sample requires the following prerequisites:

To run the LambdaLanguage sample level

  1. In Lumberyard Editor, choose File, Open or press Ctrl+O.

  2. In the Open a Level dialog box, expand Levels.

  3. Choose LambdaLanguage, and then click Open.

  4. Click Play Game or press Ctrl+G to switch to gameplay mode. After a short pause, a message reports success, as seen in the following image.

                Lambda functions in different languages report success in the LambdaLanguage
                  sample level

Additional Resources

For information on how the sample applications were built, see the following topics in the AWS Lambda Developer Guide.