AWS CDK Tutorial: Deploy a Python Lambda Function using AWS

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

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

  • @Patrick-hl1wp
    @Patrick-hl1wp 3 месяца назад +1

    clear explanation, thank you

    • @pixegami
      @pixegami  3 месяца назад

      Glad it was helpful!

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

    Great vid, im learning here :D

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

      Glad to hear it!

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

    Great video!

  • @rubo111
    @rubo111 Год назад +1

    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.

    • @pixegami
      @pixegami  Год назад +1

      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 :)

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

      @@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!

  • @bickelmeister
    @bickelmeister 2 года назад +2

    WHat is that awesome terminal :O

    • @pixegami
      @pixegami  2 года назад +2

      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.

  • @brandonmcdaniel6018
    @brandonmcdaniel6018 Год назад +1

    Thank you! 👍

  • @jesusperdomo8388
    @jesusperdomo8388 Год назад +1

    Again, thank you very much. I would greatly appreciate it if you please activate the subtitles in the videos. 😉

    • @pixegami
      @pixegami  Год назад +1

      Thanks for the suggestion! I'll look into how to add subtitles.

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

      @@pixegami thank you friend for your generosity

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

    I get an error "InvalidClientTokenId, security token included in the request is invalid" How do I fix this please?

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

      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

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

      @@pixegami Thank you for the reply! It worked once I connected MFA

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

    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

    • @pixegami
      @pixegami  Год назад +1

      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 :)

  • @unknown3713
    @unknown3713 2 месяца назад

    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

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

    btw what does -e . does in the requirements.txt file? pardon me if its a dumb question..

  • @shafiqrezal2855
    @shafiqrezal2855 3 месяца назад +1

    Is this video still okay? or there is new way of doing deployment IAAS?

    • @pixegami
      @pixegami  3 месяца назад

      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

    • @shafiqrezal2855
      @shafiqrezal2855 3 месяца назад

      @@pixegami thanks 🙏

  • @mobinrood4986
    @mobinrood4986 Год назад +1

    is this API deployed in this manner private or public?

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

      This is a public API. But you can always add authentication to it.

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

    How does your VSCode do CDK syntax autocomplete?

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

      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?

  • @xuloIsaias
    @xuloIsaias Год назад +2

    Minute 4:20, why did you copy something and pasted something different?

    • @pixegami
      @pixegami  Год назад +1

      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.

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

      @@pixegami ok xD, thanks