Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stekern/terraform-aws-paper2remarkable-lambda
Terraform module for running paper2remarkable in an AWS Lambda function.
https://github.com/stekern/terraform-aws-paper2remarkable-lambda
aws-lambda remarkable-tablet terraform
Last synced: 6 days ago
JSON representation
Terraform module for running paper2remarkable in an AWS Lambda function.
- Host: GitHub
- URL: https://github.com/stekern/terraform-aws-paper2remarkable-lambda
- Owner: stekern
- Created: 2020-12-12T13:23:52.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T17:25:47.000Z (about 1 year ago)
- Last Synced: 2023-12-15T18:33:25.974Z (about 1 year ago)
- Topics: aws-lambda, remarkable-tablet, terraform
- Language: Python
- Homepage:
- Size: 11.7 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# terraform-aws-paper2remarkable-lambda
A Terraform module that creates an AWS Lambda function for calling [paper2remarkable](https://github.com/GjjvdBurg/paper2remarkable).The Lambda uses a custom Docker image (see [src/Dockerfile](src/Dockerfile)) which comes with paper2remarkable and its dependencies installed.
You can opt-in to receive emails if paper2remarkable fails to process a given input, or if the Lambda function itself times out.
## Set up
You need to first manually create the tokens for [rmapi](https://github.com/juruen/rmapi/), and then store these tokens in the parameter `//rmapi-config` in AWS Parameter Store using the following format:
```json
{"rmapi_device_token": "", "rmapi_user_token": ""}
```You also need to build the Docker image and host it in ECR, e.g.:
```sh
$ docker build -t ".dkr.ecr..amazonaws.com/-paper2remarkable" ./src
$ aws ecr get-login-password --region | docker login --username AWS --password-stdin ".dkr.ecr..amazonaws.com"
$ docker push ".dkr.ecr..amazonaws.com/-paper2remarkable"
```## Usage
After setting up the credentials, you can run the Lambda as such:
```sh
aws lambda invoke \
--function-name -paper2remarkable \
--payload '{"inputs": ["https://arxiv.org/abs/1406.2661"]}' \
output.json
```You can further integrate the Lambda function with AWS API Gateway to set up a REST API for the function -- allowing you to send files to your reMarkable from anywhere with an internet connection!
## TODOs
- Host the image in a public ECR repository.
- The Lambda somestimes failes due to an error `[Errno 2] No such file or directory ` -- seems to be related to reuse of Lambda execution context. Changing the directory to a known directory seems to fix this, but may need to research this further and see if it can be handled in a more robust manner.
- A normal run takes roughly 60 seconds.
- May be an idea to use a Fargate task instead of a Lambda, but there's an inherent ~30 sec start-up time here.
- Docker image can probably be simplified and minimized (currently sits at 500 MB).