IN THIS ARTICLE
Updating Projects and Cloud Gems to Version 1.0.0 of the Cloud Gem Framework
Updating Projects and Cloud Gems to Version 1.0.0 of the Cloud Gem Framework
A cloud gem is a gem that depends on the Cloud Gem Framework. Starting in Lumberyard 1.10 \(and Cloud Gem Framework 1\.0\.0\), gem versioning support makes the work of updating Lumberyard cloud gem projects much easier. However, manual steps are required to update projects and gems that were created before Cloud Gem Framework version 1.0.0.
Updating Existing Cloud Gem Projects
To update an existing cloud gem project, you must update the project’s gems.json file and runtime configuration.
To update an existing Lumberyard project
In the project’s
dev\<project-name>\gems.jsonfile, find the entry forCloudGemFramework. Change theVersionvalue to1.0.0and thePathvalue toGems/CloudGemFramework/v1, as in the following example.{ "Path": "Gems/CloudGemFramework/v1", "Uuid": "6fc787a982184217a5a553ca24676cfa", "Version": "1.0.0", "_comment": "CloudGemFramework" },In a command prompt window, run the following command to update the project’s runtime configuration.
dev\Tools\LmbrSetup\Win\lmbr.exe projects populate-appdescriptors -projects <project-name>For more information about
populate-appdescriptors, see Projects Commands in the documentation for Managing Game Projects with Lmbr.exe.
Update the Project’s AWS Directory
To update the project’s AWS directory, you must delete the project, deployment access, and deployment template files. But before you delete the template files, you must save any roles or resources that you added.
To update the AWS directory
Delete the
<project>\AWS\project-codedirectory. If you have made changes to this code, you must update theCloudGemFramework\vN\lambda-codedirectory content to preserve the changes that you made.If you added roles or other resources to the
<project>\AWS\project-template.jsonfile, create a<project>\AWS\project-template-extensions.jsonfile and copy those resource definitions into theproject-template-extensions.jsonfile.Delete the
<project>\AWS\project-template.jsonfile.If you added roles or other resources to the
<project>\AWS\deployment-access-template.jsonfile, create a<project>\AWS\deployment-access-template-extensions.jsonfile and copy those resource definitions into thedeployment-access-template-extensions.jsonfile.Delete the
<project>\AWS\deployment-access-template.jsonfile.If you added resources to the
<project>\AWS\deployment-template.jsonfile, create a<project>\AWS\deployment-template-extensions.jsonfile and copy those resource definitions into thedeployment-template-extensions.jsonfile.Delete the
<project>\AWS\deployment-template.jsonfile.
Update the Project’s Resource Group Directories
When no Lambda resources exist for a resource group, you can simply remove the resource group’s Lambda code directories.
To remove Lambda code directories from a project resource group
For each
<project>\AWS\resource-group\<resource-group-name>directory, check whether itsresource-template.jsonfile defines AWS Lambda function resources.If the
resource-template.jsonfile does not define any Lambda resources, delete the following directories:<project>\AWS\resource-group\<resource-group-name>\lambda-function-code<project>\AWS\resource-group\<resource-group-name>\<lambda-name>-lambda-code
If the
resource-template.jsonfile defines AWS Lambda function resources, perform the steps described in Updating Lambda Code.
Updating Existing Cloud Gems
To update an existing cloud gem, you must update the gem’s gem.json file and either remove its Lambda code directories or update its Lambda code.
To update an existing cloud gem
In the
<gem>\gem.jsonfile, find the entry forCloudGemFramework. ChangeVersionConstraintsto the following value."VersionConstraints": [ "~>1.0" ],If the
<gem>\AWS\resource-template.jsonfile does not exist or does not define any AWS Lambda function resources, delete the<gem>\AWS\lambda-function-codedirectory and any<gem>\AWS\<lambda-name>-lambda-codedirectories. Otherwise, perform the steps in Updating Lambda Code.
Updating Lambda Code
Updating Lambda code involves reorganizing your existing Lambda code directories and creating .import files as needed. For information on the reasons for this directory restructuring, see
Cloud Gem Framework and Resource Manager Versioning.
To update your Lambda code
For each of the following Lambda code directories, perform the steps that follow.
<project>\AWS\resource-group\<resource-group-name>\lambda-function-code<project>\AWS\resource-group\<resource-group-name>\<lambda-name>-lambda-code<gem>\AWS\lambda-function-code<gem>\AWS\<lambda-name>-lambda-code
If the code directory contains the
service.pyanderrors.pyfiles that support service API dispatching, delete them and add an.importfile with the following content to the directory:CloudGemFramework.LambdaServiceIf the code directory contains a
CloudCanvassubdirectory, delete the subdirectory. If you did not have to create an.importfile in step 2, add an.importfile that has the following content:CloudGemFramework.LambdaSettingsIf you already created an
.importfile in step 2, addCloudGemFramework.LambdaSettingsto the.importfile, as in the following example:CloudGemFramework.LambdaService CloudGemFramework.LambdaSettingsMove the contents of the code directory \(along with the new `.import` file, if any\) into a
<parent-dir>\lambda-code\<lambda-name>directory. Note the following:- If you had code for multiple Lambda functions in the single
lambda-function-codedirectory, decide which modules to put into the subdirectory of thelambda-codedirectory, and place them there. - If you have code that is used by multiple Lambda functions, put that code in a
<parent-dir>\common-code\<import-name>directory. To include the code with the rest of the Lambda code when it is uploaded, use an.importfile.
- If you had code for multiple Lambda functions in the single
For more information about these changes, see Cloud Gem Framework and Resource Manager Versioning.