top of page
Search

Solving AWS Cloud Quest: Templating a Serverless Application

While it wouldn't be right to share the entire solution to the DIY test section, I do think its fair to share some tips to get past recently introduced errors and exceptions.

TLDR:

Problem: Can't deploy SAM after changing the app.py code to the code in the downloaded exercise file

Solution: Change the requirements.txt file by removing "request" and adding urllib3==1.26.15

Reason: If you don't lock in the version of urllib3 to 1.26 it will go up to version 2+ which requires an updated openssl to be compiled into your python environment


Problem: Can't change the template.yaml and get it recognized to be deployed.


Solution: I recommend the following be added to the template so your database will be recognized. Add this to the yaml file just below the "HelloWorldFunction:" declaration




MySimpleTable:

Type: AWS::Serverless::SimpleTable

Properties:

TableName: MyTable

PrimaryKey:

Name: id

Type: String

ProvisionedThroughput:

ReadCapacityUnits: 5

WriteCapacityUnits: 5


Now your deployment will create the database in the cloudformation stack.


Finally, if for some reason your code commit doesn't work, go into CodeCommit itself and add the above code into your template.yaml directly.


Go to CodeCommits -> Developer Tools -> Repositories -> my-app and edit the template.yaml adding this resource in. Save, add your fake name/email and commit


These fixes should get you through it.



Comments


bottom of page