A Typescript hello world example for use with AWS Lambda. Includes a unit testing strategy as well as a bundling and multi-stage deploy strategy using AWS CodeBuild. Note, you will need to back into the deploy strategy from the buildspec as the README does not include instructions to setup automated deployments at the time of this writing.
A single test is included for demonstration purposes.
npm run test
Creates a .zip file for upload to S3/Lambda. After running the below command, you can find your bundle in build/bundle.zip.
npm run deploy:beta
The bundled code needs to be uploaded into AWS Lambda. To do so:
- Open the AWS console and the hello world lambda function.
- Scroll down to the Function code section.
- Change the "Code entry type" dropdown to read "Upload a .zip file".
- Change the "Handler" field to "index.hello".
- Click the "Upload" button and select your .zip file.
- Scroll back up to the top of the page and click the "save" button.
TODO
You can test the lambda using the usual method offered by the Lambda UI:
- Open the AWS console and the hello world lambda function.
- Click the "Test" button in the upper right hand corner.
- If you haven't created a test for your lambda yet, simply take the default json and name your new test something.
- If the lambda is successful, you'll see a green box at the top of the page. Upon expanding "Details", you should see "Hello, World" in the results box.
Feel free to send any PRs or feedback.
This project is licensed under the MIT License - see the LICENSE.md file for details