RequestBin service based on AWS Lambda.
Live-coded on the IOpipe Twitch Channel!
RequestBin's deps are documented in package.json
. You'll also need to install the serverless framework 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 (Log in if you don't see your access token).
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, then:
sls deploy
Specify S3 Bucket as Origin-- this is done in the wizard when creating CloudFront Distribution.
Associate Lambda Function for Viewer Request-- you'll use an ARN with an exact version number to associate.
curl your-lambda-domain/geturl
This will return JSON in the following format:
{
requestTo: "<https url>",
requestFrom: "<https url>",
requestFromToken: "<Bearer Token for Authorization Header>",
requestFromCurl: "<curl command that uses requestFrom url and bearer token>"
}
- Send request to
requestTo
url. - Run the
requestFromCurl
command.
If desiring to build an API consumer, make an HTTP GET request from the requestFrom
url using an Authorization: Bearer <requestFromToken>
header.
Apache/2.0