You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/lambda/README.md
+23-2Lines changed: 23 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ The primary use is to provide a base for testing Momento in an AWS lambda enviro
19
19
- Node version 14 or higher is required (for deploying the Cloudformation stack containing the Lambda)
20
20
- To get started with Momento you will need a Momento Auth Token. You can get one from the [Momento Console](https://console.gomomento.com). Check out the [getting started](https://docs.momentohq.com/getting-started) guide for more information on obtaining an auth token.
21
21
22
-
## Deploying the Momento Python Lambda
22
+
## Deploying the Momento Python Lambda with Docker and AWS CDK
23
23
24
24
The source code for the CDK application lives in the `infrastructure` directory.
25
25
To build and deploy it you will first need to install the dependencies:
@@ -42,4 +42,25 @@ npm run cdk deploy
42
42
43
43
The lambda does not set up a way to access itself externally, so to run it, you will have to go to `MomentoDockerLambda` in AWS Lambda and run a test.
44
44
45
-
The lambda is set up to make set and get calls for the key 'key' in the cache 'cache'. You can play around with the code by changing the `docker/lambda/index.py` file. Remember to update `docker/lambda/aws_requirements.txt` file if you add additional Python dependencies.
45
+
The lambda is set up to make set and get calls for the key 'key' in the cache 'cache'. You can play around with the code by changing the `docker/lambda/index.py` file. Remember to update `docker/lambda/aws_requirements.txt` file if you add additional Python dependencies.
46
+
47
+
## Deploying the Momento Python Lambda as a Zip File on AWS Lambda with the AWS Management Console
48
+
49
+
Alternatively, we can deploy the Momento Python Lambda as a Zip File on AWS Lambda. We can do this using the `zip` directory in this example.
50
+
51
+
Follow these steps to create the zip and deploy it to AWS Lambda using the AWS Management Console:
52
+
53
+
1. Run `make dist` in the `zip` directory to package the lambda for upload as `dist.zip`.
54
+
55
+
> :bulb:**Tip**: Check out the Makefile for important build steps to package for AWS Lambda.
56
+
57
+
2. Create a new Lambda function by selecting "Author from scratch".
58
+
3. Set the function name to `momento-lambda-demo`.
59
+
4. Choose the runtime as `Python 3.8` (you can adjust this as desired).
60
+
5. Select the architecture as `x86_64`.
61
+
6. Click on "Create function" to create the Lambda function.
62
+
7. In the "Code" tab, choose "Upload from the zip" as the code source.
63
+
8. Under "Runtime settings", set the Handler to index.handler.
64
+
9. Switch to the "Configuration" tab.
65
+
10. Set the environment variable `MOMENTO_API_KEY` to your API key.
66
+
11. Finally, go to the "Test" tab to test your Lambda function.
0 commit comments