The quality and effort put into this video really stands out. I've learned more from this 24 minutes than the last few hours of self guided Serverless research.
Great tutorial, thank you! It'd be great to see more content about JS and AWS :) I'd have one question: when would you choose to go for the Serverless framework (with AWS) over AWS Amplify (and vice versa)?
I've got a whole playlist of videos that use AWS and JS to build some really powerful features. ruclips.net/p/PLmexTtcbIn_gP8bpsUsHfv-58KsKPsGEo Serverless vs Amplify - Serverless is a tool to deploy AWS features and services without having to write cloudformation. This could be APIs, Lambdas, databases, step functions. Amplify (using appSync) is a tool to allow you to quickly and easily add authentication, databases and storage to your app. All of your logic lives in the app. If you're building something where you need to add a relatively simple database table to the app - use Amplify. If you want to have lot of inter-related tables, use other AWS Services ( SES, SQS, translate, comprehend, VPCs, EC2s ) and want to build APIs to take a lot of the logic and code complexity out of your front end code then use Serverless.
@@CompleteCoding Wow, thank you so much for your time to answer and your thorough explanation, now it's much clearer. I'll definitely need to check your playlist, as I'd like to get started with AWS services :)
Thanks, hearing that you're loving the content makes it worth while. I've actually got a free course here - covers building a small full-stack app skl.sh/3arTBrp
Great tutorial, and I'd like to add a quick advice to make it even better. If you're making tutorial on how to create AWS API endpoint with Serverless, don't bother explaining why Typescript is good or what is interface just stick to the topic. Anyway, good work thank you!
Thanks. I already have a video on creating APIs with Serverless (and JS). This was specifically as I have been asked about using typescript. As it needs to be compiled there are some extra steps and plugins
Awesome. Just wanted to clarify one query of mine - Are AWS profiles meant to have access control over different resources? For example, say profile p1 has access to S3, p2 has access to dynamoDB, etc. Am I right?
It depends on what you're using the AWS Profile for. AWS Profiles should only really be used for systems outside of AWS that need to interact with AWS. I only use AWS Profiles for deploying my CloudFormation stacks. If you've got a Lambda or an EC2 that needs to access S3 or Dynamo, you should be using IAM roles. You say what that IAM role can and can't do and then attach it to the lambda or EC2.
Great video, just one question, can we remove the "/dev" from our endpoints that are automatically added by the template somehow. Since I would not like all my apis to look like "/dev/user/get" and all
There are two ways. Either replace the api type with a "http" Event in the lambda definition Or create a custom domain name. You can set that so you don't have the "/dev" in your url
Is it necessary in a functional paradigm? One function should handle a unique process. If you overload your repository with many files you will end up with coldstart issues.
One unique process per lambda is ideal. With typescript and esbuilds, only the code required for each lambda will end up in that lambda deployment. If you start approaching the cloudformation 500 resource limit you can make 'multi-process' Lambdas but that's only a short term solution to creating multiple stacks
I was having some CORS issue with this code. I can access the API using multiple browser and POstman but when I actually integrate the code on my web application it is giving me this error: has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. I set the cors: true on the serverless.ts
Sam, is the code for this video on Github? I can't seem to find it. I am getting an error with serverlessConfiguration in serverless.ts and I would like to compare yours to mine. Error: Property 'configValidationMode' is missing in type '{ service: { name: string; }; frameworkVersion: string; custom: { webpack: { webpackConfig: string; includeModules: boolean; }; }; plugins: string[]; provider: { name: "aws"; runtime: string; apiGateway: { ...; }; environment: { ...; }; }; functions: { ...; }; }' but required in type 'Serverless'
We use cloud formation and nested stacks with typical javascript code. If we switched to typescript would we need to pre compile to es6 javascript or is there a way to do it automatically?
The way this project is set up, it compiles to es6 on deployment. If you're adding/updating to typescript with an existing stack then you'll need to compile before deploying. I add a build script of "deploy": "tsc && sls deploy" to my package.json and then just run "npm run deploy" instead of 'sls deploy'
As you are creating a typescript repo, the template assumes you'd rather work with a serverless.ts file. I've not tried reverting to serverless.yml but I don't see why it shouldn't work.
Optional chaining will return undefined if the property doesn't exist instead of null. Here's the link to it: developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining. Anyway, thank you for this great content. Keep it up!
You can create a unit test for the lambda code you've written. Use jest to call the handler function with an example 'event' and then check that the response is what you expect. If you add aws services (dynamo, SES, s3) then you can mock those so your unit tests stay as unit tests
@@CompleteCoding aws-typescript-node template schema validation not working with local dynamodb. how to properly validate schema before saving to dynamodb (local as well as real dynamodb) the schema.ts file which we got in template (lambda function) how do we apply proper validation in this file like min max length , email pattern,required etc.
The quality and effort put into this video really stands out. I've learned more from this 24 minutes than the last few hours of self guided Serverless research.
Thanks Jake, that means a lot. Hope you get to build some really cool projects with serverless
Absolutely great work! Concise and touches all the key areas nicely. The way you communicate and structure things make it very easy to understand!
Glad you liked it!
I really appreciate your serverless work.
Thanks. Glad you enjoy the videos
I admire people who can tolerate working with two different type of monitors
haha thanks. You're the first person to notice/comment on this
Superb the video is in simple and more understandable. Thank you lots of love from India❤️. And wish me happy Independence day.
Thank you so much 😀
Thanks, thanks thanks!!, incredible video tutorial easy to interpret and easy English. Well done!
Glad it helped!
Thank you for this tutorial! It helped me a lot
Glad it was useful
Great tutorial, thank you! It'd be great to see more content about JS and AWS :)
I'd have one question: when would you choose to go for the Serverless framework (with AWS) over AWS Amplify (and vice versa)?
I've got a whole playlist of videos that use AWS and JS to build some really powerful features. ruclips.net/p/PLmexTtcbIn_gP8bpsUsHfv-58KsKPsGEo
Serverless vs Amplify -
Serverless is a tool to deploy AWS features and services without having to write cloudformation. This could be APIs, Lambdas, databases, step functions.
Amplify (using appSync) is a tool to allow you to quickly and easily add authentication, databases and storage to your app. All of your logic lives in the app.
If you're building something where you need to add a relatively simple database table to the app - use Amplify. If you want to have lot of inter-related tables, use other AWS Services ( SES, SQS, translate, comprehend, VPCs, EC2s ) and want to build APIs to take a lot of the logic and code complexity out of your front end code then use Serverless.
@@CompleteCoding Wow, thank you so much for your time to answer and your thorough explanation, now it's much clearer.
I'll definitely need to check your playlist, as I'd like to get started with AWS services :)
Amazing... Thanks for this class... I really enjoy it... Congratulations
Glad you enjoyed the class Daniel
Expecting more industry oriented videos
Like what?
Videos describing how I'd architect certain apps?
this is so amazing. i thank you for your hard work~! i will be ur first student when ur course come out!
Thanks, hearing that you're loving the content makes it worth while.
I've actually got a free course here - covers building a small full-stack app skl.sh/3arTBrp
This video is awesome! Thank you!!
Glad you liked it!
Great tutorial, and I'd like to add a quick advice to make it even better. If you're making tutorial on how to create AWS API endpoint with Serverless, don't bother explaining why Typescript is good or what is interface just stick to the topic. Anyway, good work thank you!
Thanks. I already have a video on creating APIs with Serverless (and JS). This was specifically as I have been asked about using typescript. As it needs to be compiled there are some extra steps and plugins
Awesome. Just wanted to clarify one query of mine -
Are AWS profiles meant to have access control over different resources? For example, say profile p1 has access to S3, p2 has access to dynamoDB, etc. Am I right?
It depends on what you're using the AWS Profile for. AWS Profiles should only really be used for systems outside of AWS that need to interact with AWS. I only use AWS Profiles for deploying my CloudFormation stacks.
If you've got a Lambda or an EC2 that needs to access S3 or Dynamo, you should be using IAM roles. You say what that IAM role can and can't do and then attach it to the lambda or EC2.
Why did they change yml to ts extention in serverless configuration file?
I think that it was just so the code and the config is all in the same style. Having type checking on the serverless file is actually really useful.
Great video, just one question, can we remove the "/dev" from our endpoints that are automatically added by the template somehow. Since I would not like all my apis to look like "/dev/user/get" and all
There are two ways.
Either replace the api type with a "http" Event in the lambda definition
Or create a custom domain name. You can set that so you don't have the "/dev" in your url
Amazing videos in your channel, can you make a video on Testing with typescript
I have a video on testing lambda and dynamo. It would be almost identical with typescript.
ruclips.net/video/k-rOgqiGe34/видео.html
Is it necessary in a functional paradigm? One function should handle a unique process. If you overload your repository with many files you will end up with coldstart issues.
One unique process per lambda is ideal. With typescript and esbuilds, only the code required for each lambda will end up in that lambda deployment.
If you start approaching the cloudformation 500 resource limit you can make 'multi-process' Lambdas but that's only a short term solution to creating multiple stacks
Great..Helpful video. Thanks.
My pleasure
Thanks!
Could you indicate how you have configured the webpack.config.js file please
if you follow this video and use "aws-nodejs-typscript" template, it now uses "ES-Builds". This is way better than webpack.
@@CompleteCoding thanks for this heads up
Absolutely amazing
Thanks. Glad you liked it
I was having some CORS issue with this code. I can access the API using multiple browser and POstman but when I actually integrate the code on my web application it is giving me this error:
has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
I set the cors: true on the serverless.ts
In the response body you also need to set the headers of
{
statusCode: XXX,
body: { ... },
headers: {
=> 'Access-Control-Allow-Origin': '*'
}
}
Sam, is the code for this video on Github? I can't seem to find it. I am getting an error with serverlessConfiguration in serverless.ts and I would like to compare yours to mine.
Error: Property 'configValidationMode' is missing in type '{ service: { name: string; }; frameworkVersion: string; custom: { webpack: { webpackConfig: string; includeModules: boolean; }; }; plugins: string[]; provider: { name: "aws"; runtime: string; apiGateway: { ...; }; environment: { ...; }; }; functions: { ...; }; }' but required in type 'Serverless'
just add this in serverless.ts -> configValidationMode: "error",
@@AmirulAbu1 Thank you.
It looks like @Amirul Abu sorted this one for you. Does it now work?
We use cloud formation and nested stacks with typical javascript code. If we switched to typescript would we need to pre compile to es6 javascript or is there a way to do it automatically?
The way this project is set up, it compiles to es6 on deployment.
If you're adding/updating to typescript with an existing stack then you'll need to compile before deploying.
I add a build script of "deploy": "tsc && sls deploy" to my package.json and then just run "npm run deploy" instead of 'sls deploy'
Why is it creating a serverless.ts file and not a serverless.yml file ? And could you somehow go back to a serverless.yml file?
As you are creating a typescript repo, the template assumes you'd rather work with a serverless.ts file. I've not tried reverting to serverless.yml but I don't see why it shouldn't work.
Can you please link to your cityData in the description? Thnx.
I've just added that :)
I hope sometime in the future you will make an introductory video on AWS-Kinesis for microservices.
I'll add it to the list and look into it
@@CompleteCoding where / how did you get the serverless command?
@@WhyteTunez npm i -g serverless
That will allow you to use the serverless CLI
Thank you ...
Optional chaining will return undefined if the property doesn't exist instead of null. Here's the link to it: developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining.
Anyway, thank you for this great content. Keep it up!
Nice spot.
is possible combinate nestjs framework with serverless typescript framework ? maybe a project with typescript as standard language
That's a really cool idea. I'll look into it and add it to the video idea list
How do you unit test that service,
You can create a unit test for the lambda code you've written. Use jest to call the handler function with an example 'event' and then check that the response is what you expect.
If you add aws services (dynamo, SES, s3) then you can mock those so your unit tests stay as unit tests
what is your color theme?
Monokai Pro. I think it was $10 but it's just a really nice theme in my opinion and well worth it
sir i want to ask a question please reply me...? i really need your help
What's your question?
@@CompleteCoding aws-typescript-node template schema validation not working with local dynamodb. how to properly validate schema before saving to dynamodb (local as well as real dynamodb) the schema.ts file which we got in template (lambda function) how do we apply proper validation in this file like min max length , email pattern,required etc.