Skip to content

Commit 741a690

Browse files
authored
updated README.md
updated SAM deployment instructions
1 parent fa7f1f2 commit 741a690

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

README.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,31 @@ Else create a new bucket using the following AWS CLI command:
2929
```
3030
aws s3 mb s3://<your-bucket-name>
3131
```
32+
33+
Before deploying the project to SAM for the first time, you'll need to update some variables in `lambda_function.py` and `template.yaml`/`swagger.yaml` (found in `sam/` folder). Additionally, you'll need to zip `lambda_function.py` after updating the variables.
34+
35+
```
36+
# lambda_function.py
37+
account_sid = "account_sid" # Twilio account SID
38+
auth_token = "auth_token" # Twilio auth token
39+
dynamodb = boto3.resource('dynamodb', '_region') # AWS region set in Pre-Requisites
40+
table_users = dynamodb.Table('table_name') # name of DyanmoDB created in Pre-Requisites
41+
42+
# swagger.yaml
43+
# <<region>> : AWS region set in Pre-Requisites, referenced twice in swagger.yaml
44+
# <<accountId>> : your global AWS account ID (found in MyAccount)
45+
uri: arn:aws:apigateway:<<region>>:lambda:path/2015-03-31/functions/arn:aws:lambda:<<region>>:<<accountId>>:function:${stageVariables.LambdaFunctionName}/invocations
46+
47+
# template.yaml
48+
CodeUri: s3://<bucket-name>/lambda_function.py.zip # name of S3 bucket created in Pre-Requiisites
49+
DefinitionUri: s3://<bucket>/swagger.yaml # name of S3 bucket created in Pre-Requisites
50+
```
51+
52+
Once updated, zip `lambda_function.py` and place both `swagger.yaml` and `lambda_function.py.zip` into the S3 bucket
53+
3254
To deploy the project for the first time with SAM, and for each subsequent code update, run both of
3355
the following AWS CLI commands in order.
3456

35-
NOTE: Make sure you update the template.yaml and swagger.yaml (sam/ folder) with the code-uri, region and
36-
account id before running the commands. Refer to comments in the files for more info
37-
3857
You can use the basic_lambda_function.py as the reference for a simple backend to test the end to
3958
end flow
4059

0 commit comments

Comments
 (0)