https://github.com/mslosarz/aws-lambda-typescript
Template for lambda function written in TypeScript
https://github.com/mslosarz/aws-lambda-typescript
aws-lambda aws-lambda-node template-project typescript
Last synced: 8 months ago
JSON representation
Template for lambda function written in TypeScript
- Host: GitHub
- URL: https://github.com/mslosarz/aws-lambda-typescript
- Owner: mslosarz
- Created: 2019-02-14T22:32:19.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-18T19:40:48.000Z (about 7 years ago)
- Last Synced: 2025-04-02T06:51:18.793Z (12 months ago)
- Topics: aws-lambda, aws-lambda-node, template-project, typescript
- Language: Groovy
- Size: 32.2 KB
- Stars: 12
- Watchers: 1
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# What is this?
Here you can find template for AWS Lambda written in TS.
To build project you need to type:
`npm run all`
Build process consists of:
- linting project (TSLint)
- running tests
- generating js files (tsc)
- trimming node_modules to production only
- creating zip file with lambda code and dependencies (zip is stored in dist directory)
When you have zip file, you can create your lambda function. It can be done by AWS Web Console.
Navigate to lambda functions, then click `Create Function`, pickup name for you function, and click `Create`.
AWS should redirect you to lambda configuration page. Now to deploy your lambda you need to do the following steps:
- navigate to section `Function code`, and change `code entry type` to `upload a .zip file`.
- upload generated lambda.zip
- set `Runtime` to `Node.js 8.10`
- change handler to `dist/handler.handler`
That's all :) now you can enjoy playing with lambda written in TypeScript
# There is another way to do that!
As you can see this project contains Jenkinsfile so you can easily build and deploy this lambda automatically!
(If you don't have remote jenkins you can spin up your local copy you can find project [here](https://github.com/mslosarz/aws-jenkins))
What needs to be done:
1. create folder in your existing Jenkins e.g. dev/test/prod (it's very important because folder is used to distinguish environment)
2. Inside folder create the pipeline job (with the name you want), and configure it to use jenkinsfile from this project
3. Run build!
# How to get rid of all created resources?
To clean up AWS resources you need to navigate AWS Console / cloudformation and delete two stacks `-ts-lambda` and `-deployment-bucket`.
S3 Bucket [will not be deleted automatically](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html) so you need to remove it manual :(