Can custom cloud gems access DynamoDB or Bucket?

I’ve been trying to get a basic Cloud Gem working within Lumberyard to access a dynamo DB table. I used the initial template api-lambda-dynamodb and tested with the Rest Explorer in Cloud Gem portal several times, but continually get the error:

“Status: 500, Message: Service Error: An internal service error has occurred.”

Further testing has shown that the S3 bucket also has a similar issue when using its own template. Lambda function by themselves work in both template and when getting server_status from other templates.

I believe it’s an issue with the “swagger.json” or the “” files but cannot get any different results from making changes. It does not give much insight into what exactly is going on. Is this a bug, or does an extra step is required?

Hi @Tarn1902,

Thanks for reaching out.

Have you successfully created a project stack and deployment before calling the service API? You can find the CloudWatch log via CloudGemPortal or the AWS console for CloudWatch. The name for the CloudWatch log group should look like /aws/lambda/your_lambda_function_name. You may find more details about the error in the log.

Also could you point me to the initial templates you’re using?

Making some assumptions that you have APIGateway → ServiceLambda → DyanamoDB

Find the ServiceLambda in the lambda console, go to monitoring and see if any recent calls have failed. Click on those logs to go the log group. I find looking at log groups individually a pain, so learning how to use CloudWatch insights can make this faster.

Whats most likely happening is your ServiceLambda is:

Thanks for replying.

For the case of dynamo DB, the initial content I used was:


as part of the creation command:

lmbr_aws cloud-gem create --gem {gem-name} --initial-content {content-option} --enable

This issue is the same for:


@Junbo_LMBR & @Pip
Cloud watch helped to find the issue. I don’t know why, but the error message has changed for both get and post to:

[ERROR] Client Error: CloudCanvas_request_id : 19dc2c18-d1c4-4887-b589-14cee9955a08 failed with name ‘table_data’ is not defined"

So, it is finding the file “” now, which is a step forward but seems to be unable to find the “” file now, which is linked by the “import table_data” and function that use it.

Would the issue be related to the “” file or is it another issue?

Hi @Tarn1902 Thanks for the information. Did you customize the file before the deployment? Also could you please check the deployed AWS Lambda function (You can download the deployed package from the AWS console for Lambda) and make sure that “table_data” is imported correctly in Thanks.

1 Like

Ok so it looks like this sample code has a few issues

  • Lambda timeout is only 3s, which means when first deployed you may see a timeout
  • The sample code is wrong (my apologies, we have logged a bug against this).

Quick Fixes:

  1. Up the timeout
"Runtime": {     
     "Fn::GetAtt": [ 
 "Timeout": 10
  1. Code Bug

Apologies, been trying a few things and went down one wrong path, but basically your ‘’ function should look a little like this at the top:

import boto3.dynamodb.conditions
 import botocore.exceptions

  CONDITION_KEY_EXISTS = boto3.dynamodb.conditions.Attr('Key').exists() 

If you make those changes and use the ‘upload lambda code’ function in the Editor for your CloudGem’s resource group. You should be good.

This change worked for me.

1 Like

@Junbo_LMBR & @Pip
Thank you both for your help. It is finally working.

@Junbo_LMBR The last error I got was because I changed the “” file by forgetting to uncomment the “import table_data” line, which caused the issue. So silly of me. Looking at the deployed package really helped me find this error and is a good suggestion for future issues.

@Pip Changed both things, as you said, and now it seems to be working great. The top of the code now looks like this:

from future import print_function

import uuid

import boto3
import botocore.exceptions

import CloudCanvas

table_name = CloudCanvas.get_setting(‘Table’)

dynamodb = boto3.resource(‘dynamodb’)
table = dynamodb.Table(table_name)

CONDITION_KEY_EXISTS = dynamodb.conditions.Attr(‘Key’).exists()