Skip to content

Commit

Permalink
AWS Lambda tutorial quick fixes (github#390)
Browse files Browse the repository at this point in the history
* Fix image

* Image fix and placeholder

* Add placeholders

* Placeholders
  • Loading branch information
zseta authored Sep 13, 2021
1 parent 354a027 commit ef2a903
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
4 changes: 2 additions & 2 deletions timescaledb/tutorials/aws-lambda/3rd-party-api-ingest.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ To create a Lambda function from your container, you can use the Lambda
```bash
aws lambda create-function --region us-east-1 \
--function-name docker_function --package-type Image \
--code ImageUri=<ECR Image URI> --role arn:aws:iam::818196790983:role/Lambda
--code ImageUri=<ECR Image URI> --role <ARN_LAMBDA_ROLE>
```

## Schedule the Lambda function
Expand All @@ -193,7 +193,7 @@ an EventBridge trigger. This creates a rule using a [`cron` expression][cron-exa
[
{
"Id": "docker_lambda_trigger",
"Arn": "<FUNCTION_ARN>"
"Arn": "<ARN_LAMBDA_FUNCTION>"
}
]
```
Expand Down
10 changes: 3 additions & 7 deletions timescaledb/tutorials/aws-lambda/create-data-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ workaround to this issue is to download the
```
1. At the AWS Lambda console, check to see if your `psycopg2` has been uploaded
as a Lambda layer:
```bash
![aws layers](https://assets.timescale.com/docs/images/tutorials/aws-lambda-tutorial/layers.png)
```

## Create a function to fetch and return data from the database
When the layer is available to your Lambda function, you can create an API to
Expand Down Expand Up @@ -111,13 +109,11 @@ Lambda using the `create-function` AWS command.
```bash
aws lambda create-function --function-name simple_api_function \
--runtime python3.8 --handler function.lambda_handler \
--role arn:aws:iam::818196790983:role/Lambda --zip-file fileb://function.zip
--role <ARN_LAMBDA_ROLE> --zip-file fileb://function.zip
```
1. You can check that the function has been uploaded correctly by using this
command in the AWS console:
```bash
![aws lambda uploaded](https://assets.timescale.com/docs/images/tutorials/aws-lambda-tutorial/lambda_function.png)
```
1. If you make changes to your function code, you need to zip the file again and use the
`update-function-code` command to upload the changes:
```bash
Expand Down Expand Up @@ -268,15 +264,15 @@ API gateway. In AWS terms, you are setting up a
of `GET /ticker?symbol={symbol}`:
```bash
aws apigateway put-method-response --region us-east-1 \
--rest-api-id <API_ID> --resource-id r9cakv \
--rest-api-id <API_ID> --resource-id <RESOURCE_ID> \
--http-method GET --status-code 200
```
1. Connect the API Gateway to the Lambda function:
```bash
aws apigateway put-integration --region us-east-1 \
--rest-api-id <API_ID> --resource-id <RESOURCE_ID> \
--http-method GET --type AWS --integration-http-method POST \
--uri arn:aws:lambda:us-east-1:818196790983:function:simple_timescale/invocations \
--uri <ARN_LAMBDA_FUNCTION> \
--request-templates file://path/to/integration-request-template.json
```
1. Pass the Lambda function output to the client as a `200 OK` response:
Expand Down

0 comments on commit ef2a903

Please sign in to comment.