Build a Real Time Data Streaming System with AWS Kinesis, Lambda Functions and a S3 Bucket

Поделиться
HTML-код
  • Опубликовано: 22 окт 2024

Комментарии • 106

  • @FelixYu
    @FelixYu  3 года назад +3

    Video on send emails in lambda: ruclips.net/video/mL-4PeuAuWc/видео.html
    Video on save data to a database: ruclips.net/video/Ut5CkSz6NR0/видео.html

    • @IRFANSAMS
      @IRFANSAMS 2 года назад

      Can you make a video on Credit card fraud detection and entire transformation from capturing streaming data , Historic data to uploading in s3 and for prediction insagemaker

  • @nandyalasurparaju2834
    @nandyalasurparaju2834 2 года назад

    I learned a lot of real-time use cases of AWS services from your channel. Thanks! for your efforts and please keep doing Felix.

    • @FelixYu
      @FelixYu  2 года назад

      Glad that u found my tutorials helpful!!

  • @boypotus
    @boypotus 2 года назад

    One thing that will improve content is explaining maybe each concept as if hovering over it in vs code // where it explains things ie: say stringing then give a small summary for it because everyone won’t know these things

  • @saltdomeguy
    @saltdomeguy 3 года назад

    Glad I found you. I've been looking for some walk-thru projects. Keep em coming.

  • @shubhayanai8981
    @shubhayanai8981 2 года назад +9

    Code for producer :
    const AWS=require('aws-sdk')
    AWS.config.update({
    region:'us-east-1'
    })
    const s3=new AWS.S3()
    const kinesis= new AWS.Kinesis()
    exports.handler = async (event) => {
    console.log(JSON.stringify(event));
    const bucketName = event.Records[0].s3.bucket.name;
    const keyName = event.Records[0].s3.object.key;
    const params = {
    Bucket: bucketName,
    Key: keyName
    }
    await s3.getObject(params).promise().then(async (data) => {
    const dataString = data.Body.toString();
    const payload = {
    data: dataString
    }
    await sendToKinesis(payload, keyName);
    }, error => {
    console.error(error);
    })
    };
    async function sendToKinesis(payload, partitionKey) {
    const params = {
    Data: JSON.stringify(payload),
    PartitionKey: partitionKey,
    StreamName: 'mydatastream'
    }
    await kinesis.putRecord(params).promise().then(response => {
    console.log(response);
    }, error => {
    console.error(error)
    })
    }
    Code for Consumer:
    exports.handler = async (event) => {
    console.log(JSON.stringify(event));
    for (const record of event.Records) {
    const data = JSON.parse(Buffer.from(record.kinesis.data, 'base64'));
    //send emails clients, publish the data social media
    console.log('cosumer #2', data);
    }
    };

  • @rahuldeo5813
    @rahuldeo5813 3 года назад

    This is a great tutorial, previously, I just have basic idea about AWS stuffs, now with this tutorial, I learned the Kinesis data streaming part very easily. which can help me with my upcoming Interviews. Thanks a lot :) Felix.

    • @FelixYu
      @FelixYu  3 года назад

      You are welcome!! Best of luck with ur upcoming interview :)

  • @totachava6235
    @totachava6235 2 года назад

    thank you for writing the code step by step and explaining it, its really helpful for beginners :)

    • @FelixYu
      @FelixYu  2 года назад

      Glad that u found it helpful :)

  • @bindureddy6148
    @bindureddy6148 Год назад

    Hi Felix Yu, You are videos are clean, precise, and very informative. Can you make a video on Kafka?

  • @sentinelese6717
    @sentinelese6717 2 года назад +1

    Great stuff and awesome explanation. Throughly enjoyed.

    • @FelixYu
      @FelixYu  2 года назад +1

      Glad that it helped 👍

  • @rashigupta5995
    @rashigupta5995 Год назад

    Thank you Felix !

  • @Karthik_I_Am_
    @Karthik_I_Am_ 2 года назад

    Im glad that i found you and your videos really help me and many like me. So my request would be AwS Pyspark with Big Data pipelines and Aws Dynamo DB. Please consider this and thanks in advance. Much appreciation!

  • @nainaarabha9186
    @nainaarabha9186 Год назад

    Can we directly send the data from lambda functions to consumers? If yes, tell me the cons

  • @reeturajchatterjee
    @reeturajchatterjee 3 года назад

    You saved my Day! Thanks a lot Felix.

    • @FelixYu
      @FelixYu  3 года назад

      np..Glad that it helped :)

  • @mehmetkaya4330
    @mehmetkaya4330 Год назад

    Thanks a lot for another great tutorial!!

    • @FelixYu
      @FelixYu  Год назад

      Glad you liked it!

  • @muditmishra9908
    @muditmishra9908 Год назад

    Hi Felix, does in real time system, is it common to have get data first in to s3 and then produce to kinesis data stream using lambda ? Can you please make a video on different type of producers and which one to choose ? I want to know how to decide the producer if we are designing real time system say with latency of milliseconds and also for near real time like having latency of say in minutes to hour. Thanks

  • @kristofferhaukaasberg6258
    @kristofferhaukaasberg6258 3 года назад +1

    This is great! Thanks so much, Felix! I was looking for a simple tutorial that scratch the basics of all these fragments in AWS, and also in Javascript - so this was spot on.
    I'm building a service that posts messages to a websocket handler (Lambda function) and I want to save that information coming from the websocket (basically health data from an iot-device). So from there, AWS Kinesis seems like a good idea to collect all incoming data from these devices, and then consume the data into a ie. DynamoDB.
    BTW: Are you open for freelance work with small AWS-based projects?

    • @FelixYu
      @FelixYu  3 года назад

      Thanks man!! I appreciate the offer but I don’t think I have time for freelance work atm!!

  • @kpashupati
    @kpashupati 3 года назад

    I am great fans of your aws videos.Kindly help me to understand how one lambda is calling another lambda and also updating 2 diffrent databases..Like product is purchased by customer and also updated in product inventory. In node js please😊

    • @FelixYu
      @FelixYu  3 года назад +1

      u have to like all my videos before i answer this question......just joking lol
      there are 3 ways u can enable one lambda to call another lambda:
      1. use a "middle man" like kinesis or sqs. lambda #1 construct a data object send it to kinesis/sqs and then it triggers lambda #2. lambda #2 then extracts the data object and do whatever u want with it
      2. attach an alb (application load balancer) to lambda #2 so it acts as an API and then lambda #1 calls the alb to invoke lambda #2
      3. lambda #1 calling lambda #2 directly using the invoke method. here is a reference to that (www.sqlshack.com/calling-an-aws-lambda-function-from-another-lambda-function)
      i personally like the first approach the most but all 3 would work!!
      for ur second question, u can just perform 2 dynamo requests (one per each table). just change the dynamoTableName in the request params (e.g., github.com/felixyu9/serverless-api-tutorial-code/blob/main/index.js#L80-L83)

    • @kpashupati
      @kpashupati 3 года назад +1

      @@FelixYu thanks lot...I have successfully implemented ..Actually I was trying to implement ticket reservation system..While booking the ticket it will also minus the seat from the main table also keep booked seat no in users table...
      Thanks again..I am just having 1 month of exp in AWS.

    • @FelixYu
      @FelixYu  3 года назад

      Nicee..glad that u figured it out and good luck with the aws exploration 👍

  • @rashigupta5995
    @rashigupta5995 Год назад

    Can you share the difference between using apache kafka and kinesis?

  • @_Documentation
    @_Documentation 2 года назад +1

    💯

  • @anandchiluka7611
    @anandchiluka7611 2 года назад

    Nice video, thanks for the detailed explanation

    • @FelixYu
      @FelixYu  2 года назад

      Glad that it’s helpful!!

  • @lavakumar5181
    @lavakumar5181 2 года назад

    very clear explanation...please try to do lambda functions on python too

  • @AS-zw4lk
    @AS-zw4lk 3 года назад

    Thanks for your content. It is really helpful.

  • @techdesk915
    @techdesk915 3 года назад

    Nice content Felix : )
    love to see more of these projects.
    it helps learn a lot : )

    • @FelixYu
      @FelixYu  3 года назад

      Thank you thank you :)

  • @Namaryop
    @Namaryop 2 года назад

    good quality video, keep up with the good work!

    • @FelixYu
      @FelixYu  2 года назад

      Thank you!! :)

  • @abelcarvajalgil6705
    @abelcarvajalgil6705 2 года назад

    great demo!!

    • @FelixYu
      @FelixYu  2 года назад

      Glad that u found it helpful 👍

  • @sagar1689
    @sagar1689 2 года назад

    Thank you for this video. Very helpful 👍

    • @FelixYu
      @FelixYu  2 года назад

      Glad that it’s helpful!!

  • @RedCloudServices
    @RedCloudServices 2 года назад

    Is there a NodeJS function that connects to a remote JMS ConnectionFactory endpoint for use inside the vpc?

  • @samyaktjain698
    @samyaktjain698 2 года назад

    Hi Felix, I need producer for CLICKSTREAM then what is the changes we need in the lambda code? Please correct me If I am wrong.

  • @rajibmahato2608
    @rajibmahato2608 2 года назад

    awesome sir

  • @evanserickson
    @evanserickson 2 года назад

    Could you also use step functions and put it all in one?

  • @monuramadutta454
    @monuramadutta454 2 года назад

    Good work

  • @BlackSk8ter100
    @BlackSk8ter100 3 года назад

    Good stuff Felix. Keep going.

    • @FelixYu
      @FelixYu  3 года назад

      Thank you thank you :)

  • @frankyan8135
    @frankyan8135 2 года назад

    thank you

    • @FelixYu
      @FelixYu  2 года назад

      Glad that u found it helpful

  • @dotan2211
    @dotan2211 3 года назад

    Hi Felix, I have question that can we modify the data received from S3 bucket or API gateway, then save it to DynamoDB by using Lambda Function

    • @FelixYu
      @FelixYu  3 года назад

      yes u certainly could..for example, in consumer 1 lambda, u can read in the data as json/strings/numbers and then u make changes to it to make it a different (e.g., numeric calculation, string concatenation, etc.) and then u can save this new data to dynamodb

  • @pohboonxin4137
    @pohboonxin4137 3 года назад

    Hi Felix , It is a nice and clear video. One question, may I know if there can be applied on other types of sources data such as pdf, jpg? Can I add a aws textract in between to read the text from document or image rather than just text file ?

    • @FelixYu
      @FelixYu  3 года назад

      yes..in 5:17 of the video, if you leave the Suffix field blank, u can upload any file types and it will trigger the producer lambda

    • @pohboonxin4137
      @pohboonxin4137 3 года назад

      @@FelixYu Yes, it will trigger the producer lambda. Could you show something like using textract and convert other formats of source data into csv ?

  • @2mahender
    @2mahender 3 года назад

    Can you do one video on Athena,Glue,and EMR

  • @igordatsenko5283
    @igordatsenko5283 2 года назад

    thanks!

    • @FelixYu
      @FelixYu  2 года назад

      glad that u found it helpful 👍

  • @Overbound
    @Overbound 2 года назад

    thanks

  • @darshithaindupally1515
    @darshithaindupally1515 2 года назад

    I am getting errors like "Cannot read property '0' of undefined", and "event. Records is not iterable", can you rectify the error

  • @nishantshah4718
    @nishantshah4718 2 года назад

    where does cloud front comes into picture?

  • @ganeshnayak4179
    @ganeshnayak4179 3 года назад

    Can you please make a video with Python instead of Node JS. Though the content was quite explanatory. Thanks Felix for awesome content

    • @FelixYu
      @FelixYu  3 года назад

      I can write the code in python and then push it to GitHub when I get a chance. All other setups will be the same!!

  • @pranayshukla9980
    @pranayshukla9980 2 года назад

    My use case is Amazon connect data -> kinesis data stream -> delivery stream lambda -> se can you help me with lambda heree

  • @pradeepsharma9035
    @pradeepsharma9035 3 года назад

    Hi Felix what if I have s3 in one aws and kinesis on another . And if I added cross account policy on lambda as well. What should I do in lambda to send the data to kinesis on another aws account.

    • @FelixYu
      @FelixYu  3 года назад +1

      if u have the producer lambda in account A and then wanna write data to a kinesis stream in account B, u will needa configure 2 roles.
      1. in account B, create a role that has write access to the kinesis stream (e.g., putRecord, PutRecordBatch, etc.). let's call it kinesis-role-in-account-B.
      2. in account A, create a role (let's call it lambda-role-in-account-A) and use this role to assume the kinesis-role-in-account-B that was created in step #1. attached this role to the lambda and it will be able to send data to kinesis in account B!!

  • @parikshithshivaprakash5523
    @parikshithshivaprakash5523 2 года назад

    this is same as s3 streaming files right

  • @sormagupta9170
    @sormagupta9170 2 года назад

    I am getting error "stream/kinesis-stream because no identity-based policy allows the kinesis:PutRecord action" while porsting data to kinesis stream

    • @FelixYu
      @FelixYu  2 года назад

      Make sure u have the kinesis policy for ur iam role (1:55 of the video)

  • @2mahender
    @2mahender 3 года назад

    nice, hi sir, can these lambda functions usefull for Video,audio files also?

    • @FelixYu
      @FelixYu  2 года назад

      i think so. u just needa find a lib that handles video files and add the logic in the lambda code

  • @weilichen2961
    @weilichen2961 2 года назад

    Hi Felix, love your video, if it is possible to be Python code in lambda? Thanks

    • @FelixYu
      @FelixYu  2 года назад

      Yea u can write the lambda in python as well

  • @Roop-tk2rb
    @Roop-tk2rb 3 года назад

    Please advise where can we find the source code for this example

    • @FelixYu
      @FelixYu  3 года назад

      sorry i dont think i keep the code after i uploaded the video :(( try to pause the video and copy the code that way. let me know if u run into any problems!!

  • @khandoor7228
    @khandoor7228 3 года назад

    Felix loving your channel, great content! Can we do more with Lambda functions? They seem to be an important link to many other services in AWS. For these 2 consumers maybe send an email with 1 and save to dynamo with the other?

    • @FelixYu
      @FelixYu  3 года назад +1

      tyty 😄 and yessir, we can certainly do more with lambda functions!! lambda has gained a lot of popularities in recent years becuz it is light weight, easy to set up and great for horizontal scaling.
      u just reminded me that i do already have videos for send emails in lambda and saving data to dynamo database:
      send emails in lambda: ruclips.net/video/mL-4PeuAuWc/видео.html
      save data to database: ruclips.net/video/Ut5CkSz6NR0/видео.html

  • @kavyap3184
    @kavyap3184 3 года назад

    Hello Felix, Thanks for the content. Is it possible to have the Json file (Source with JSON format) template from s3 to Kinesis?.

    • @FelixYu
      @FelixYu  3 года назад

      yes, just change txt to json in the s3 trigger suffix 5:18 of the video and u can upload json files as the data source (e.g., test_file.json) (or just leave that field blank so it will take all file types). let me know if that works

    • @kavyap3184
      @kavyap3184 3 года назад

      @@FelixYu Hi Felix, Thanks for the quick response. I have tried with changing the suffix of the file in S3. But this does not work either .

    • @FelixYu
      @FelixYu  3 года назад +1

      @@kavyap3184 gotcha....lets try a few things here.
      1. when u have the txt suffix set up and upload a txt file (the exact setup i have in the video), does everything work fine?
      2. after u change txt to json and upload a json file, does it trigger the producer lambda? if not, it might be a permission issue.
      3. if it triggers the producer lambda, lets console.log out dataString and see how it looks like (9:29 of the video)

    • @kavyap3184
      @kavyap3184 3 года назад

      @@FelixYu Thanks for the suggestion. It is just that my file is too big to process. Also do we see the records in the AWS data stream ?. Because specific data stream monitor shows no data even though i see the data in console.

    • @FelixYu
      @FelixYu  3 года назад +1

      Yea if ur file is big, u needa increase the producer lambda timeout and memory....and I don’t think u can look at the data from aws console. Under monitoring u can see metrics like incoming data in bytes, get record counts, etc

  • @victoriabressan4557
    @victoriabressan4557 2 года назад

    I want to stream but to a event bus. I couldn't find a way yet...

  • @subhamchakraborty6822
    @subhamchakraborty6822 3 года назад

    Hi, is it possible to generate a real-time drill rig data stream by AWS Kinesis?

    • @FelixYu
      @FelixYu  3 года назад +1

      Yes, u would have to build a data producer that process the drill rig data and then sends it to kinesis thou

    • @subhamchakraborty6822
      @subhamchakraborty6822 3 года назад

      @@FelixYu Thanks! Is it possible to build a data producer via AWS?

    • @FelixYu
      @FelixYu  3 года назад

      @@subhamchakraborty6822 i guess a better question is - are u able to connect aws with ur drill rig system cuz idk how u have ur drill rig system set up and where u store the data

    • @subhamchakraborty6822
      @subhamchakraborty6822 3 года назад

      @@FelixYu I am planning to build the drill rig via MATLAB Simulink. But I don't know it's possible to connect the system with AWS or not.

    • @FelixYu
      @FelixYu  3 года назад +1

      @@subhamchakraborty6822 the easiest way i can think of is that..after matlab saves teh data to ur machine, u can write a script/cron job/program to upload the data to aws s3 and have that trigger a lambda function to send the data to kinesis

  • @austinchettiar6784
    @austinchettiar6784 2 года назад

    Can i get the same code in python pls?

  • @saswanthikaschannel7708
    @saswanthikaschannel7708 3 года назад

    I am getting an error like cannot read property of 0 of undefined

    • @FelixYu
      @FelixYu  3 года назад

      its prob caused by a typo....make sure it is event.Records[0]

  • @priyaavhad3688
    @priyaavhad3688 Год назад

    Hi need the producer code can you pls help

  • @suresh1088
    @suresh1088 2 года назад

    Link for the code ?

  • @mohammedshihab8577
    @mohammedshihab8577 3 года назад

    Video was very good to understand, would you mention your mail id I had some queries related to iot service

  • @asifhossain1874
    @asifhossain1874 Год назад

    Please upload the code in Python here Sir...

  • @abstractionGod
    @abstractionGod 6 месяцев назад

    Oh nvm lol

  • @ALDARPRATHAMESH
    @ALDARPRATHAMESH 6 месяцев назад

    there's error that says "The specific log group: /aws/lambda/consumer1 does not exist in this account or region."

  • @stevebalu
    @stevebalu 3 года назад

    got The specific log group: /aws/lambda/Producer does not exist in this account or region.
    errors. can't see the triggered logs

    • @FelixYu
      @FelixYu  3 года назад

      two things to check here:
      1. make sure the cloudwatch console u are viewing in the same region as the lambda function
      2. make sure the iam role the lambda is using has the CloudWatchLogsFullAccess policy attached to it

  • @randomvideos6117
    @randomvideos6117 3 года назад

    Consumer1 - send to elastic search