Sending messages to SQS from AWS Lambda

Поделиться
HTML-код
  • Опубликовано: 5 авг 2024
  • In this video we will learn how to send messages to SQS from a Lambda function.
    Timestamps:
    - Intro: 0:00​
    - Create SQS queue: 2:51
    - Write Lambda code: 3:11
    - Time for testing: 5:05
    Code example: github.com/endre-synnes/pytho...
    Subscribe button animation: touchtechnologyreview.com/sub...
    Follow me on Github: github.com/endre-synnes

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

  • @ethandv6225
    @ethandv6225 5 месяцев назад

    2 years later and this video is still extremely helpful and useful! Your style and pacing was great as well! Thanks for concise and helpful tutorial

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

    These videos are really good! please keep making them.

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

      Thank you, I will! 😄 I'm working on a video about Kinesis for next week. Let me know if there is any topic you want me to cover in future videos 🙌

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

    Thank you very much. Your video helps me a lot.
    I managed to create a queue, and send message from the lambda.

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

    Love this video, Thank you! I'm working on a solution where my application which requires this as part of the application. My use case uses SES to deliver a raw email object to S3, trigger a lambda to cross into gov cloud to deliver a presigned object to SQS to be then picked up by another lambda! This helps me get some things cleared up on this project that i was a bit confused about.Thanks again!

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

      Thank you!😄 Fantastic to hear that this video could help you in your project!

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

    Excellent 👌

  • @user-tf1iq7mr1w
    @user-tf1iq7mr1w 8 месяцев назад

    thanks

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

    I have a query. Can't the destination configuration be used directly then the boto3 method?

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

      Hi, sorry for the late reply! I'm not quite sure what you mean by the destination configuration being used directly? In my example I'm adding the destination configuration (queue URL) directly in the send method.
      An alternative could be to use boto3.resource('sqs') instead of boto3.client('sqs') as shown here: boto3.amazonaws.com/v1/documentation/api/latest/guide/sqs.html#sending-messages
      In the example linked above, they use Resource (boto3.amazonaws.com/v1/documentation/api/latest/guide/resources.html#guide-resources) instead. This is a higher level abstraction which can provide an even cleaner implementation in your code. The only downside is that Resource is still quite limited when it comes to other services than SQS, SNS and S3.
      I hope this answered your question, if not let me know 😄

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

    I would like to make a queuing application. Would sis be a good start ?

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

      Hi 😄
      Yes SQS is a good service for getting started with queuing applications. As I talk about in this video, you can choose between Standard and FIFO SQS queues which both has their advantages and disadvantages, depending on you requirements. There are also other AWS managed services which provide queuing in some form or an other, like for instance AWS Kinesis, which I've made two videos about:
      - ruclips.net/video/2a0BF97yVwA/видео.html
      - ruclips.net/video/Obwuug7dUSE/видео.html
      AWS also have a kafka service called MSK, which I may make a video about at some point.

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

    how to send message from Lambda in a AWS account 1 to a SQS in a different region in Account1 and Different AWS account(account 2)?

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

      Hi😄
      If you want to send messages to another region in the same account using the boto3 sdk, then you need to define the destination region in the boto3 client object like this:
      client = boto3.client("sqs", region_name="DESTINATION_REGION_NAME").
      This is because region is not read from the queue url ( aws.amazon.com/premiumsupport/knowledge-center/sqs-queuedoesnotexist-errors/ ).
      I have not tested sending messages a queue in another account, but i guess this should work: stackoverflow.com/questions/59396973/how-to-send-messages-to-an-sqs-queue-in-a-different-aws-account
      By the way if you haven't, you should look into the pricing of cross region data transfer as they may differ from data being sent within the same region😊

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

    Is its possible for you to provide some code snippet for node js.?

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

      Hi, thank you for the question! 😄
      I could write a code snippet myself, but I don't think It would be any better than the one provided in the AWS documentation (since I'm not a node.js expert)🙈. I'll link that here: github.com/awsdocs/aws-doc-sdk-examples/blob/main/javascript/example_code/sqs/sqs_sendmessage.js
      I hope this is what you where looking for? 😄

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

      @@EndreSynnes thank you 😀

  • @andybarrell26
    @andybarrell26 4 месяца назад

    I was hoping there was a way to send the message to the SQS queue without needing to know the exact SQS URL.
    Similar to how you can call other Lambdas without hitting the function URL when already in a Lambda.

    • @EndreSynnes
      @EndreSynnes  4 месяца назад +1

      Hi 😄
      I would also like that, but the only way to do that (that I have seen), is to first call the "get_queue_url" function: boto3.amazonaws.com/v1/documentation/api/latest/reference/services/sqs/client/get_queue_url.html

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

    CAn you please tell how to send msg from 1 was account to another using SQS

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

      Hi,
      I have not tested sending messages a queue in another account, but I know it should work: stackoverflow.com/questions/59396973/how-to-send-messages-to-an-sqs-queue-in-a-different-aws-account
      I can make a video about this in the future 😄

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

      ​@@anishachoudhury_ Yes, I guess the example in the link you provided should be good alternative if you are working with AWS IoT 😄 I'm not sure what your use case is, but if you are for example working with AWS lambda, and want to read/write messages from an SQS queue in another account. Then this should also work: docs.aws.amazon.com/lambda/latest/dg/with-sqs-cross-account-example.html
      Anyways, good that you found a solution that works for you! 😄

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

    Why does this clip have 5 views and fake pranks have millions

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

      Thank you 🙌😊 It has been fun making these videos, so It’s going to be interesting to see if they at some point gain more traction. That being said, my main motivations are creating videos about topics that interest me and motivating people to learn about the opportunities within cloud development 😃