I am trying to create a Lambda function (Python 3.6) that will write some content to DynamoDB. Currently, I'm just trying to get a hello world going. However, my Lambda Function times out whenever I actually try to do something with dynamo beyond just connecting to the table. Can you please advise?
Here's some relevant info:
- I have configured my Lambda to run in a VPC (this is a requirement, as it will ultimately be triggered by Alexa Skills Kit)
- My lambda & dynamo are both in US-West2 (Oregon)
- I have added
AWSLambdaDynamoDBExecutionRole
andAmazonDynamoDBFullAccess
to the IAM role that is used by the Lambda function.
Note: I am relatively new to AWS, so please forgive me if I'm missing something obvious.
Here's the code:
import boto3
dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table('some_table')
table.put_item(
Item = {
'person_id': 1,
'msg': 'hello world'
}
)
In the above code, the import, dynamodb, & table statements execute without issue. When I add the table.put_item
call, I get a Task timed out
message. The above code is based on https://boto3.readthedocs.io/en/latest/guide/dynamodb.html#using-an-existing-table
Thanks in advance for the help!