BiteSize Academy
BiteSize Academy
  • 27
  • 455 612
How to test and develop AWS lambda functions locally with nodejs?
⚡️ Blog post and source code: www.undefinedapps.com/post/test-develop-lambda-locally
In this video we build a nodejs lambda function while running and testing it locally.
The lambda function that gets arguments from query params, uses axios to download the html of a website, uses cherio to parse out the title of the page and then saves the html file to S3 and returns a json response back to the user.
We write local tests for the function using mocha and sinon (to create stubs).
The video also covers:
- creating and deploying lambda functions to AWS
- setting up an S3 bucket
- running the lambda function from a public url
- managing lambda releases
- setting up github actions to deploy to AWS on 'git push'
0:00 intro
0:31 explain & demo the function we're testing
1:40 create and run the lambda locally
3:54 create the lambda function on AWS + permissions
4:34 bundle & deploy our local code to AWS
6:21 create a public url to access our function
7:14 write the code to download the html and parse the title (using axios and cherio)
8:52 manage the release of our function
9:45 write tests using mocha and sinon
12:27 create a stub for axios.get() using sinon
15:25 write the code to save files to S3 (using aws-sdk)
12:27 create a stub for S3
17:25 create an S3 bucket on AWS + permissions
18:15 run the function in production
19:06 adjust the tests
19:42 create a GitHub action
21:27 deploy to aws on every 'git push'
22:58 use our new workflow
26:16 create integration e2e tests
⭐️ Subscribe for more content: newsletter.undefinedapps.com/
#aws #lambda #nodejs
Переглядів: 17 201

Відео

How to drag and resize in react using react-spring and use-gesture?
Переглядів 7 тис.2 роки тому
In this video we'll see how to build a video editing crop tool using reactjs and react-spring use-gesture. ⚡️ Source code and blog post: www.undefinedapps.com/post/drag-resize-react-spring-use-gesture First we build the UI using Mui, a React UI Library. Then, we add a react component which overlays on top of our video player element and lets the user make a selection by dragging and resizing a ...
How to bundle a nodejs lambda function? (using esbuild)
Переглядів 4,2 тис.2 роки тому
In this video we bundle a nodejs lambda function using lambda-build (powered by esbuild). ⚡️ Blog post and links: www.undefinedapps.com/post/bundle-nodejs-lambda-esbuild ⭐️ Subscribe for more content: newsletter.undefinedapps.com/ #AWS #Lambda #serverless
How to deploy a lambda function using versioning and aliases + API Gateway
Переглядів 8 тис.2 роки тому
In this video we create a lambda function (a random number generator) and use versions and aliases to manage the deployment of the lambda function. ⚡️ Blog post: www.undefinedapps.com/post/deploy-lambda-versioning-aliases-api-gateway - 0:00 Intro: what are versions (numeric and $LATEST) and aliases and what are they useful for? - 1:58 Iteration #1 - creating the lambda function, a new version, ...
How to build a chat using Lambda + WebSocket + API Gateway? (nodejs)
Переглядів 50 тис.3 роки тому
⚡️ Blog post and source code: www.undefinedapps.com/post/lambda-websocket-api-gateway-chat In this video we build a real-time chat app (like slack) that uses websockets backed by an AWS lambda function and Amazon API Gateway. The app sends JSON over the websocket to deliver the chat messages and notifications in real time, over a two-way communication line, to all the users of the chat. 0:00 De...
How to drag and drop a div in react using hooks? (react-use-gesture + react-spring)
Переглядів 17 тис.3 роки тому
⚡️ Live demo and source code: www.undefinedapps.com/post/drag-drop-div-react-hooks In this video we look at how to drag and drop in react using the react-use-gesture and react-spring libraries. We take the introduction screen of create-react-app and add dragging to its components. We then add an overlay which can be dragged up and down to expose a background image behind it. We use the hooks: u...
How to pass a url query string or a route parameter to AWS Lambda from API Gateway?
Переглядів 13 тис.3 роки тому
⚡️ Blog post: www.undefinedapps.com/post/url-query-route-parameters-lambda-api-gateway In this video we integrate a lambda function with an API Gateway HTTP endpoint and define a proxy route to direct all incoming requests to our function. We then extract the path and the url query string parameters from the event object which is provided as an argument to the lambda function. ⭐️ Subscribe for ...
How to restrict access to a static S3 site using HTTP Basic Auth?
Переглядів 22 тис.3 роки тому
In this video we add basic auth to an s3 bucket containing a static website. ⚡️ Blog post: www.undefinedapps.com/post/restrict-access-s3-http-basic-auth This way, the browser will display an authentication dialog and require a username and password to get access to the static site. This will protect the files on our s3 bucket and limit access to them. We use a cloudfront distribution and a lamb...
How to animate mount and unmount of a react component? (react-spring)
Переглядів 67 тис.3 роки тому
⚡️ Blog post: www.undefinedapps.com/post/animate-mount-unmout-react-spring In this video we add animations to the mount and unmount events of a react component using the react-spring animation library and hooks, in a create-react-app project. ⭐️ Subscribe for more content: newsletter.undefinedapps.com/ #react #animate #javascript
How to deploy a lambda function using github actions?
Переглядів 30 тис.3 роки тому
⚡️ Blog Post: www.undefinedapps.com/post/deploy-lambda-github-actions In this video we deploy a lambda function using GitHub actions ⭐️ Subscribe for more content: newsletter.undefinedapps.com/ #lambda #aws #github
How to generate a time limited presigned S3 URL using the nodejs AWS SDK?
Переглядів 13 тис.3 роки тому
In this video we create a time limited signed url for an image store on S3, using nodejs. ⚡️ Blog post: www.undefinedapps.com/post/generate-time-limited-presigned-s3-url-aws-sdk Using S3 signed urls, we can limit access to S3 files only to users who has access to these urls. We can also limit the amount of time in which these users can access the files. We also see learn how to generate signed ...
How to connect AWS Lambda to a MySQL database to update it? (using RDS proxy)
Переглядів 32 тис.3 роки тому
⚡️ Blog post: www.undefinedapps.com/post/lambda-mysql-rds-proxy In this video we connect from a lambda function to an RDS database, first directly and then by using RDS proxy. ⭐️ Subscribe for more content: newsletter.undefinedapps.com/ #lambda #mysql #nodejs
How to use AWS Textract to extract plain text from an image or a document
Переглядів 4,9 тис.3 роки тому
⚡️ Blog: www.undefinedapps.com/ In this video we use AWS Textract to extract the text of an image Check out QR Menu Creator here: qrmenucreator.com/ Source code available here: github.com/BiteSizeAcademy/aws-textract-example ⭐️ Subscribe for more content: newsletter.undefinedapps.com/
How to use environment variables with a Lambda function? (and how to encrypt them with KMS)
Переглядів 17 тис.4 роки тому
AWS Lambda: How to store a secret to an external API? ⚡️ Blog post and source code: www.undefinedapps.com/post/env-variables-lambda-function-kms In this video we take a look at how secrets, private keys and passwords should be stored in a lambda function. First, we extract hardcoded secrets into environment variables, then we learn how to encrypt these variables using a key from KMS (Key Manage...
How to use ImageMagick with a Lambda function on AWS?
Переглядів 9 тис.4 роки тому
⚡️ Source code and blog post: www.undefinedapps.com/post/imagemagick-lambda ImageMagick is a popular open source utility to transform images. It used to be installed on the OS which lambda functions use, but was removed in the latest version. In this video we look at how to use ImageMagick in a lambda function using lambda layers. We look at an open source project which creates a layer for us t...
How to use layers with Lambda functions?
Переглядів 40 тис.4 роки тому
How to use layers with Lambda functions?
How to install npm modules in AWS Lambda?
Переглядів 55 тис.4 роки тому
How to install npm modules in AWS Lambda?
What is an AWS lambda function?
Переглядів 1,9 тис.4 роки тому
What is an AWS lambda function?
AWS Lambda intro - versions, aliases, concurrency, triggers, logs and monitoring
Переглядів 3,6 тис.5 років тому
AWS Lambda intro - versions, aliases, concurrency, triggers, logs and monitoring
Introduction to AWS IAM - policies, permissions, users, groups and roles
Переглядів 1,9 тис.5 років тому
Introduction to AWS IAM - policies, permissions, users, groups and roles
Setup ssl/https with an S3 bucket using AWS Cloudfront
Переглядів 10 тис.5 років тому
Setup ssl/https with an S3 bucket using AWS Cloudfront
Part 5 - monitoring our app using cloudwatch
Переглядів 4815 років тому
Part 5 - monitoring our app using cloudwatch
Part 4 - uploading, deleting and listing files using the AWS s3 API
Переглядів 12 тис.5 років тому
Part 4 - uploading, deleting and listing files using the AWS s3 API
Part 3 - implementing a rest API using Lambda and API Gateway
Переглядів 1,4 тис.5 років тому
Part 3 - implementing a rest API using Lambda and API Gateway
Part 2 - building a backend for a file uploader app using AWS services
Переглядів 1,4 тис.5 років тому
Part 2 - building a backend for a file uploader app using AWS services
Part 1 - Build a file uploader backend using AWS Lambda, API Gateway, S3, Route53, IAM, Cloudwatch
Переглядів 2,2 тис.5 років тому
Part 1 - Build a file uploader backend using AWS Lambda, API Gateway, S3, Route53, IAM, Cloudwatch
Upload a file to an S3 bucket using the AWS SDK
Переглядів 14 тис.5 років тому
Upload a file to an S3 bucket using the AWS SDK

КОМЕНТАРІ

  • @muks
    @muks День тому

    I want to know if it's possible to create a presigned URL with your script that has expiry for 1 year? Please suggest, Thanks a ton. YOur video was valuable.

  • @andrewcbuensalida
    @andrewcbuensalida 7 днів тому

    @BiteSizeAcademy, during development on your local machine, require('/opt/utils') won't work. Would you just do require(process.env.NODE_ENV === 'production' ? '/opt/utils' : './utils') so that it automatically knows where to look for the utils folder?

  • @lowzyyy
    @lowzyyy Місяць тому

    Extremely good explanation. Thank you

  • @bhavikpunmiya9641
    @bhavikpunmiya9641 Місяць тому

    Thank you so much bro ❤

  • @alexarevalo1971
    @alexarevalo1971 2 місяці тому

    I cant go further than the third step, seems like the next button isn't working. Do somebody has the same problem?

  • @jeevank3849
    @jeevank3849 2 місяці тому

    I have been searching for this video for two weeks, and finally I got it.

  • @martinprice3613
    @martinprice3613 2 місяці тому

    I found this really helpful. Allot of other examples out there make assumptions about your existing stack/configuration. This was easy to follow, informative and required little prior configuration. Keep up the great work!

  • @arashgolrokhian8835
    @arashgolrokhian8835 2 місяці тому

    you saved me 2 hours thank you

  • @anantgarg8725
    @anantgarg8725 3 місяці тому

    I owe you my life. thank you

  • @colillo9939
    @colillo9939 3 місяці тому

    Nice video!!!!

  • @alonsofts
    @alonsofts 3 місяці тому

    Saved my life! Thank you!

  • @smritieligar2518
    @smritieligar2518 4 місяці тому

    i am getting Unexpected server response: 502 when i run wscat(9:38 timeline in the video). how do i solve it?

    • @iamkarthykeyan
      @iamkarthykeyan Місяць тому

      Yea I'm too facing the same issues ! Can you please tell me what to do next? If you resolved..

  • @EmilieZawadzki
    @EmilieZawadzki 5 місяців тому

    After adding additionnal permissions, this authentication code through me a 503 error. It is weird that I could already reach the limit of lambda just after creation.

  • @GeorgeMartinJose
    @GeorgeMartinJose 6 місяців тому

    Thank you, I really understood it

  • @Giiven_Siisanda
    @Giiven_Siisanda 6 місяців тому

    Great video, well explained for a beginner..

  • @btgaston
    @btgaston 6 місяців тому

    this is an amazing video. thank you!

  • @Caramelon-e4u
    @Caramelon-e4u 6 місяців тому

    Is there a way to see how much this will cost with aws price calculator?

  • @SirFelixCoin
    @SirFelixCoin 6 місяців тому

    Thank you for doing this. Are you able to add multiple authentication credentials for every viewer?

  • @Dudarinho
    @Dudarinho 6 місяців тому

    it seems that ui has changed now and there are more settings to do and permissions to add

  • @milenurkov964
    @milenurkov964 7 місяців тому

    great explanation ! 🎉

  • @kevinfundarek5294
    @kevinfundarek5294 7 місяців тому

    Excellent work! Thank you for creating this.

  • @ET5620-q4s
    @ET5620-q4s 7 місяців тому

    how to find lambda-npm file location

  • @roshnipathan-j2z
    @roshnipathan-j2z 7 місяців тому

    I am not getting response from web socket api Connected (press CTRL+C to quit) > {"action":"setName","name":"bob"} >

    • @KenyK47
      @KenyK47 6 місяців тому

      Did you find a solution to this?

  • @alien-web
    @alien-web 7 місяців тому

    Really I love it dud

  • @tegasteve8195
    @tegasteve8195 7 місяців тому

    Thanks so much for this video

  • @iiBeka
    @iiBeka 8 місяців тому

    thx very much i love it ❤❤

  • @DuffMan
    @DuffMan 8 місяців тому

    If anyone is trying this lately, I don't know if something changed in AWS, but I was getting bad gateway from the wscat connection. So I checked cloudwatch and it was giving me this error: Error: Cannot find module 'aws-sdk'". So I installed @aws-sdk/client-apigatewaymanagementapi directly and it fixed the issue. Usage: import { ApiGatewayManagementApiClient, PostToConnectionCommand, } from '@aws-sdk/client-apigatewaymanagementapi' const command = new PostToConnectionCommand({ ConnectionId: id, Data: Buffer.from(JSON.stringify(body)), }) return await client.send(command)

    • @Neosdragon
      @Neosdragon 4 місяці тому

      Can you further elaborate on this?

  • @AbhishekKumar-wx3dh
    @AbhishekKumar-wx3dh 8 місяців тому

    How do you handle error from the lambda fn. Error which can come from not connecting to db.

  • @joanenchev847
    @joanenchev847 8 місяців тому

    Awesome. Simple and easy to understand. Great job.

  • @NeeleshDeloitte
    @NeeleshDeloitte 8 місяців тому

    Great video mate! Clear and precise!

  • @NeeleshDeloitte
    @NeeleshDeloitte 8 місяців тому

    Great video mate!

  • @testatestb
    @testatestb 8 місяців тому

    Thanks! Its helpful :)

  • @isohumulone
    @isohumulone 9 місяців тому

    Where is the array variable "ids" initialized.

  • @rickstergg
    @rickstergg 9 місяців тому

    Thank you for this! I like that this doesn't use too many of the other github actions available, but gets straight to the point so we can understand the commands and building blocks of these steps, which will eventually allow us to fish even bigger. Dropped a like, thank you so much!

  • @manshalkhatri9289
    @manshalkhatri9289 9 місяців тому

    Thanks man it was helpful

  • @olhodetamarutaca
    @olhodetamarutaca 9 місяців тому

    excelente example using html.

  • @saranyadec1952
    @saranyadec1952 9 місяців тому

    Hi i m saranya. I have followed the steps you have expalined in the video. But still i was not login to the website it alsways asking for the credentials. How i can solve this??

  • @MovesDev
    @MovesDev 10 місяців тому

    Thank you for using typescript! Great video

  • @abhisharma1471
    @abhisharma1471 10 місяців тому

    thankyou for this video it help me alot , if someone looking to understand the basics of aws websocket just watch this video thanks once again

  • @abdulbasitrana2743
    @abdulbasitrana2743 10 місяців тому

    Excellent tutorial and very well explained in detail.

  • @Kalagan64
    @Kalagan64 10 місяців тому

    Great Video! It's now almost 2024. Would you do things differently now?

  • @captaineddy
    @captaineddy 10 місяців тому

    How do you prevent bot spam with this setup?

  • @JoshuaVillena-k4n
    @JoshuaVillena-k4n 11 місяців тому

    Why when i use npm i --save dependency1 dependency2 etc... node_modules has more dependencies than it installs

  • @lautarovaleiras3623
    @lautarovaleiras3623 11 місяців тому

    awesome

  • @likithravva2246
    @likithravva2246 11 місяців тому

    Awesome tutorial ALex!!Love from india

    • @sampatil5474
      @sampatil5474 7 місяців тому

      i have some problem with implementation can u help?

  • @Archaon12
    @Archaon12 11 місяців тому

    Really great video. What if we have multiple lambda functions, does each function need to have its own repository?

  • @medAmineRg
    @medAmineRg 11 місяців тому

    great video

  • @RajarshiGhoshal
    @RajarshiGhoshal 11 місяців тому

    why is there no serverless.yml file?

  • @PoliceCK
    @PoliceCK 11 місяців тому

    are you seriously? where is fucking command line was apear??? where it was connected? wtf man you a the bad techer

  • @Pongant
    @Pongant Рік тому

    Nice overview!