https://github.com/iopipe/lambda-requestbin
RequestBin service using AWS Lambda
https://github.com/iopipe/lambda-requestbin
aws-lambda iopipe-labs labs
Last synced: 5 months ago
JSON representation
RequestBin service using AWS Lambda
- Host: GitHub
- URL: https://github.com/iopipe/lambda-requestbin
- Owner: iopipe
- License: apache-2.0
- Created: 2018-03-28T14:19:53.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-22T07:38:57.000Z (over 2 years ago)
- Last Synced: 2024-04-09T22:03:30.317Z (about 1 year ago)
- Topics: aws-lambda, iopipe-labs, labs
- Language: JavaScript
- Size: 154 KB
- Stars: 4
- Watchers: 3
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RequestBin-Lambda
## *WARNING* This is not production-ready code and is not supported by IOpipe.
RequestBin service based on AWS Lambda.
Live-coded on the [IOpipe Twitch Channel](https://twitch.tv/iopipe)!
## Setup
### Install dependencies/tools
RequestBin's deps are documented in `package.json`. You'll also need to install the [serverless framework](http://serverless.com) as a build tool.
```
npm i
sudo npm i -g serverless
```You'll want to change the IOpipe access token on line 13 of `serverless.yml` with [your access token](https://dashboard.iopipe.com/install) (Log in if you don't see your access token).
### Deploy via `sls`
Create an s3 bucket called `{your_app_name}-requestbin` and give the lambdas deployed by this project permission to PUT objects into those buckets as well as GET them. Then, set the environment variable in `serverless.yml` on line 12 called `custom.bucket` to the same name.
Make sure you've [configured your AWS login with serverless framework](https://serverless.com/framework/docs/providers/aws/guide/quick-start/), then:
```
sls deploy
```### Configure CloudFront Distribution
#### Create CloudFront Distribution
Specify S3 Bucket as Origin-- this is done in the wizard when creating CloudFront Distribution.
#### Edit Behavior
Associate Lambda Function for Viewer Request-- you'll use an ARN with an exact version number to associate.
## Making Requests
### Get a RequestBin:
```
curl your-lambda-domain/geturl
```This will return JSON in the following format:
```
{
requestTo: "",
requestFrom: "",
requestFromToken: "",
requestFromCurl: ""
}
```### Use the RequestBin:
1. Send request to `requestTo` url.
2. Run the `requestFromCurl` command.If desiring to build an API consumer, make an HTTP GET request from the `requestFrom` url using an `Authorization: Bearer ` header.
# License
Apache/2.0