DEV Community

Cover image for SAM: Serverless Application Model (CloudResumeChallenge)
Sudha Chandran B C
Sudha Chandran B C

Posted on

SAM: Serverless Application Model (CloudResumeChallenge)

After creating simple Resume with html and css and uploading into S3 with CloudFront tools, here come's the difficult task for creating DynamoDB table, API and Lambda function using Python using SAM (Serverless Application Model).

I spent some time in learning Python and boto3 and how to use both in SAM templates which are in yaml files.

Being first time working on yaml files, it took some time to go through examples and understand the concept.

Then created required assets one by one in SAM Template.

  1. Dynamo DB: To save the number of visits to my resume site.
  2. Lambda: A python function to fetch, create and update the visit count into Dynamo DB Table.
  3. API: Do get the number of visits from Lambda function to avoid direct communication with Dynamo DB from the frontend code.

DynamoDB

Added parameter in the template to get the Tablename in CLI.
And use it in the template to create user defined table name.

Parameters in CLI:
Alt Text

Table Created:
Alt Text

Lambda

Alt Text

API Gateway

Alt Text

SAM Stack Creation

Alt Text

API endpoint Created

Alt Text

So till now our Architecture will look like below:

Alt Text

Pending: Set up GitHub Actions to automate build, test and deployment of Code.

Hopefully i will complete it ASAP.

Thank you for reading! 😊

Top comments (0)