Compile AWS Lambda function with TypeScript to one with JavaScript and finally deploy it.
- Globally installed node
- Globally installed AWS Command Line Interface
$ git clone https://github.com/tadasho/ts-lambda-pipeline.git
$ cd ts-lambda-pipeline/
$ npm install
Rewrite [FUNCTION_NAME]
at package.json , line 13
- If you don't have Lambda Function yet, configure and rewrite the 13th line of package.json
"build:lambda": "aws lambda create-function \
--region us-east-1 \
--function-name CreateTableAddRecordsAndRead \
--zip-file fileb://file-path/app.zip \
--role execution-role-arn \
--handler app.handler \
--runtime nodejs6.10 \
--vpc-config SubnetIds=comma-separated-subnet-ids,SecurityGroupIds=default-vpc-security-group-id \
--profile adminuser"
Reference:
- Edit /src/index.ts
$ npm run build
This TypeScript program is slack bot using AWS Lambda to receive events and respond to specific messages.
It looks for the words aws and lambda. If found, it will respond by mentioning the sender and giving Lambda praises.
- Make Slack API App of your Slack team
- Create an AWS Lambda Function and API Endpoint referring to this
- Uncheck the checkbox for
API Gateway: Resources > /slack > POST > Integration Request > Use Lambda Proxy integration
- Handle events from the Events API using AWS Lambda referring to this
Let's type "aws" or "lambda" at your slack team !!