This post will cover the public web architecture for Project OtterVanguard.

Creating DynamoDB:

  1. Navigate to DynamoDB in the AWS Portal and select ‘Create table’:

  1. Give the table a name and enter the partition key:

  1. We have created the DynamoDB table for the website:

4. Navigate to the table and under ‘Additional info’ save the ARN for later steps:

Creating Lambda Function

  1. Navigate to Lambda in the AWS console and select ‘Create function’:

  1. Give the function a name and select Python 3.12 for the runtime:

  1. In the code tab, add the function code listed in the GitHub repository and select ‘Deploy’:

Adding permissions:

In order to allow the Lambda to access the DynamoDB, we will need to add read and write permissions to the Lambda.

  1. Inside the Lambda function, select on the configuration tab and permissions. Clock on the role name to be directed to another browser tab:

  1. Select ‘Add permissions’ and ‘Create inline policy’:

  1. In the ‘Choose a service’ box, type ‘DynamoDB’ and select it:

  1. Select the ‘Scan’ and ‘PutItem’ for the access level:

  1. Under Resources, paste the ARN of the DynamoDB we created in Step 1. The resource region and table name should autofill.

  1. Once you have added the ARNs, select ‘Next’ and ‘Create policy’:

7. We can now see the DynamoDB permissions in the Lambda function:

Testing the Lambda function

Now we have added the proper permissions, we can test to see if the function can add values to the DynamoDB.

  1. Navigate to the code of the Lambda function and select ‘Test’