Another great video. Just to add, I followed along on the 2023/9/10. I'm guessing we are now fully on CDK v2. So I had to modify the apigateway bit as the modules have changed. I used this instead (just to get this working: there might be a better way using HTTP API, but REST was the quickest): from aws_cdk.aws_apigateway import LambdaRestApi def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None: super().__init__(scope, construct_id, **kwargs) random_drink_lambda = aws_lambda.Function( self, id="RandomDrinkFunctionV2", code=aws_lambda.Code.from_asset("./first_project/compute/"), handler="random_drink.lambda_handler", runtime=aws_lambda.Runtime.PYTHON_3_10 ) LambdaRestApi( self, 'Drinkspot', handler=random_drink_lambda ) Also, the requirements.txt that comes with cdk --init has packages that contain lambda, so you don't need to do it the way it is done in this video.
Thanks! It's been a while since I did this video - I was new to it at the time. Also, CDK has changed quite a bit since then. Maybe it's time for me to do an updated version of this tutorial :)
@@pixegami If you do, I'd suggest putting it as its own playlist. So that way people can do a follow along in sequence. AWS changes a lot, I don't even bother with older videos > 1 year. I really needed to learn CDK, and this is by far the best one I have come across on the net. Previoulsy the CDK Workshop site was my main training area, but I really didn't know what I was doing as I was just copying commands to build something too "complex". Your one is simple Lambda and API Gateway; much easier to follow the code and what is created where and why, etc And mind you the slight deviation probably paid more from a learning perspective as it really forced me to think! But anyway good work!
This is just the regular Linux terminal program. I use z-shell (zsh) instead of bash. With zsh, I have the “oh-my-zsh” plugin, with the “Agnoster” theme (but I changed some colours). I also added an ‘auto-complete’ plugin so I don’t have to remember all of my commands.
That probably means your credentials are invalid or expired. To understand how AWS credentials work, I suggest reading up on the "credential provider chain": docs.aws.amazon.com/sdk-for-java/v1/developer-guide/credentials.html It basically means when you use AWS CLI or an SDK inside an app, there is a priority list of where it looks for your credentials. The one it found in your case appeared to be invalid. You might need to refresh your access keys: docs.aws.amazon.com/powershell/latest/userguide/pstools-appendix-sign-up.html
your content is amazing man, ever considerer lauch a paid course focused on AWS (for data pipelines for example)? i am very interested, keep up the awesome work! thank you so much for all the content
I do these videos as a hobby so I'm not really thinking about doing it as a paid course at this point. But if my viewers want more AWS stuff, I'm happy to work on a playlist for them :)
hi, this is really a good video but, I followed same steps but I am getting import module error inside lambda function, how to resolve this, please help
Video still works in general (AWS technology tends to be maintained for a long time), but the newer versions of CDK might have slightly different syntax, or make things a bit easier for you. This is a more recent video I have for making an API: ruclips.net/video/RGIM4JfsSk0/видео.html
These days I use GitHub co-pilot, which is really good at auto-complete. But on this video, Co-Pilot wasn't released yet - so if it looks like I'm autocompleting, it just might be from the video edit where I cut out my typing to speed up the content?
Had to watch it again since it's been a while since I made that video :P I think I was just highlighting the part in the doc that links to the AWS CDK, but the code editor I pasted the actual line you need to import to make it work.
clear explanation, thank you
Glad it was helpful!
Great vid, im learning here :D
Glad to hear it!
Great video!
Thanks!
Another great video.
Just to add, I followed along on the 2023/9/10.
I'm guessing we are now fully on CDK v2. So I had to modify the apigateway bit as the modules have changed.
I used this instead (just to get this working: there might be a better way using HTTP API, but REST was the quickest):
from aws_cdk.aws_apigateway import LambdaRestApi
def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
super().__init__(scope, construct_id, **kwargs)
random_drink_lambda = aws_lambda.Function(
self,
id="RandomDrinkFunctionV2",
code=aws_lambda.Code.from_asset("./first_project/compute/"),
handler="random_drink.lambda_handler",
runtime=aws_lambda.Runtime.PYTHON_3_10
)
LambdaRestApi(
self, 'Drinkspot',
handler=random_drink_lambda
)
Also, the requirements.txt that comes with cdk --init has packages that contain lambda, so you don't need to do it the way it is done in this video.
Thanks! It's been a while since I did this video - I was new to it at the time. Also, CDK has changed quite a bit since then. Maybe it's time for me to do an updated version of this tutorial :)
@@pixegami If you do, I'd suggest putting it as its own playlist. So that way people can do a follow along in sequence.
AWS changes a lot, I don't even bother with older videos > 1 year. I really needed to learn CDK, and this is by far the best one I have come across on the net.
Previoulsy the CDK Workshop site was my main training area, but I really didn't know what I was doing as I was just copying commands to build something too "complex".
Your one is simple Lambda and API Gateway; much easier to follow the code and what is created where and why, etc
And mind you the slight deviation probably paid more from a learning perspective as it really forced me to think!
But anyway good work!
WHat is that awesome terminal :O
This is just the regular Linux terminal program. I use z-shell (zsh) instead of bash. With zsh, I have the “oh-my-zsh” plugin, with the “Agnoster” theme (but I changed some colours). I also added an ‘auto-complete’ plugin so I don’t have to remember all of my commands.
Thank you! 👍
No worries!
Again, thank you very much. I would greatly appreciate it if you please activate the subtitles in the videos. 😉
Thanks for the suggestion! I'll look into how to add subtitles.
@@pixegami thank you friend for your generosity
I get an error "InvalidClientTokenId, security token included in the request is invalid" How do I fix this please?
That probably means your credentials are invalid or expired. To understand how AWS credentials work, I suggest reading up on the "credential provider chain": docs.aws.amazon.com/sdk-for-java/v1/developer-guide/credentials.html
It basically means when you use AWS CLI or an SDK inside an app, there is a priority list of where it looks for your credentials. The one it found in your case appeared to be invalid.
You might need to refresh your access keys: docs.aws.amazon.com/powershell/latest/userguide/pstools-appendix-sign-up.html
@@pixegami Thank you for the reply! It worked once I connected MFA
your content is amazing man, ever considerer lauch a paid course focused on AWS (for data pipelines for example)? i am very interested, keep up the awesome work! thank you so much for all the content
I do these videos as a hobby so I'm not really thinking about doing it as a paid course at this point. But if my viewers want more AWS stuff, I'm happy to work on a playlist for them :)
hi, this is really a good video but, I followed same steps but I am getting import module error inside lambda function, how to resolve this, please help
btw what does -e . does in the requirements.txt file? pardon me if its a dumb question..
Is this video still okay? or there is new way of doing deployment IAAS?
Video still works in general (AWS technology tends to be maintained for a long time), but the newer versions of CDK might have slightly different syntax, or make things a bit easier for you.
This is a more recent video I have for making an API: ruclips.net/video/RGIM4JfsSk0/видео.html
@@pixegami thanks 🙏
is this API deployed in this manner private or public?
This is a public API. But you can always add authentication to it.
How does your VSCode do CDK syntax autocomplete?
These days I use GitHub co-pilot, which is really good at auto-complete. But on this video, Co-Pilot wasn't released yet - so if it looks like I'm autocompleting, it just might be from the video edit where I cut out my typing to speed up the content?
Minute 4:20, why did you copy something and pasted something different?
Had to watch it again since it's been a while since I made that video :P I think I was just highlighting the part in the doc that links to the AWS CDK, but the code editor I pasted the actual line you need to import to make it work.
@@pixegami ok xD, thanks