Hello and welcome! Here you can find all the code from O'Reilly's 'Mastering AWS Kinesis Data Streams' online training course.
The AWS infrastructure is created and managed by AWS CDK. The application code is in TypeScript.
- Node.js 14.x
- npm
- TypeScript 2.7 or later (
npm -g install typescript
) - AWS CLI
- Configure AWS account credentials and region (
aws configure
)
- Configure AWS account credentials and region (
- AWS CDK (
npm install -g aws-cdk
)- Bootstrap CDK resourses (
cdk bootstrap aws://ACCOUNT-NUMBER/REGION
)
- Bootstrap CDK resourses (
npm install
install project dependenciesnpm run build
compile typescript to jsnpm run watch
watch for changes and compilenpm run test
perform the jest unit testscdk deploy
deploy this stack to your default AWS account/regioncdk diff
compare deployed stack with current statecdk synth
emits the synthesized CloudFormation template
The two lambda functions that act as a Kinesis producer and a Kinesis consumer are in the lambdas
directory. The lambda code itself is Node.js.
For the demonstration purposes, there are several Mocha tests written for the producer Lambda. They use Nock to mock the Kinesis HTTP responses.
To run individual test files, from the producer
directory run
npm i
npm t test/<test_file_name>
You can also run all the tests at once:
npm it
From the corresponding lambda directories, run
npm i --production
After that, the actual deployment is handled by the CDK, along with the rest of the AWS resources (cdk deploy
from the root directory).