Это видео недоступно.
Сожалеем об этом.
Serverless Aurora Database and AWS Lambda
HTML-код
- Опубликовано: 5 авг 2024
- In this video we are going to create an Amazon Aurora database and connect it to a Lambda function. Previously we have made use of DynamoDB whenever we needed a database. This is a NoSQL database and is fantastic for most use cases, but there may be times when a traditional SQL database is the best choice. This is where Aurora come in.
Timestamps:
- Intro: 0:00
- Create a Serverless Aurora Database: 1:29
- Create Lambda Function: 7:23
- Attach IAM Policy: 10:02
- Inject data to Database using Query Editor: 10:42
- Test Lambda Function12:10
Code example:
- Python code: github.com/endre-synnes/pytho...
- SQL queries: github.com/endre-synnes/pytho...
ACU: docs.aws.amazon.com/AmazonRDS...
Aurora serverless v2: aws.amazon.com/rds/aurora/ser...
AWS Aurora documentation: aws.amazon.com/rds/aurora/?au...
Pricing calculator: aws.amazon.com/rds/aurora/pri...
Subscribe button animation: touchtechnologyreview.com/sub...
Follow me on Github: github.com/endre-synnes
Thanks for simple explanation.
Looks great.
Can you create a service which can consume database (prefer Aurora RDS ) CRUD operations events and pass to a lambda function to trigger a notification.
Thank you so much!😄 I’m not sure exactly what you mean, do wonder if you can perform CRUD operations to an Aurora RDS database from a lambda function, or do you want a lambda function to somehow listen to CRUD operations against an RDS database performed by some other application? Please let me know if I misunderstood 😄
Do you know If is possible to return column names instead data types?
Well, that's a good question. I have wondered about that myself 🤔 I have yet to find a good solution to this, when calling RDS using boto3. I guess you could map the fields in the response you get from the database to variables names based on the position in the response object, but this is not a very pretty solution in my opinion. I'll look into this to see if can find a better solution!😄
Hi, sorry for the late response. You have probably figured out a solution for this by now, but I thought I could share what I found anyways😄 The boto3 library is quite limited when it comes to mapping response objects from the Serverless Aurora Data API. As mentioned in this (stackoverflow.com/questions/56822170/aws-rds-data-api-executestatement-not-return-column-names) stack overflow thread, there is a npm package called data-api-client (www.npmjs.com/package/data-api-client) which seems to alleviate some of these issues or limitations. This is for JavaScript of course, but there seems to be some alternatives for Python as well ( pypi.org/project/aurora-data-api/ and github.com/koxudaxi/py-data-api ). I have not yet tested them myself do. I hope this was useful in some way!😄
Followed your instructions and got "errorMessage": "An error occurred (AccessDeniedException) when calling the ExecuteStatement operation:
Hi 😊
I see, have you attached an IAM policy to your Lambda execution role, containing the necessary permissions to communicate with your RDS Aurora database?
How do i get row names,I mean column names insted of stringvalues
Hi, this is an issue I've been trying to solve myself. Maybe the answer I gave on the comment from @FábioEduardo could help? 😄
great! may you talk about princing? thank you
Thanks!😊 yes, pricing in Aurora could be a topic for another video 😄 It's especially interesting with the introduction of serverless Aurora databases.
Hi, nice video,
I built a the same thing what you had showed in the video. But i built it using CDK in python.
Instead of providing lambda with whole RDS permission, I added inline policy To lambda role with secretmanager secret value and rds-data permission.
I tried to add a lambda rest api gateway for the lambda function.
So that I can trigger the lambda endpoint and get the records from table.
But i met with an error as "BadRequestException, when calling the executestatement operation. Access denied for user admin @ 10.x.x.x' (using password: YES)
I have not deployed my lambda inside the vpc since it's not necessary.
Hi, I like that you make use of AWS CDK!🙌😄
I'm not sure what the issue can be, but you have remembered to enabled the Data-API feature for your Serverless Aurora database? Also, maybe these troubleshooting steps can help: aws.amazon.com/premiumsupport/knowledge-center/rds-mysql-access-denied/
Let me know if this was of any help!
@@EndreSynnes hey endre, i was able to solve the issue by reconfiguring the permission and redeploying the stack.
And yeah cdk is awesome.
Awesome!😄👍
I'll see if I can make a video about CDK at some point.
is the lbda inside the vpc or not
Hi 😄
No, the lambda function is not in the same VPC as the Aurora Serverless Database. This is one of the cool features of the Aurora DataAPI. It enables you to communicate with the Database without having to launch the Lambda function in the same VPC.
You can read more about this in the AWS documentation: docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/data-api.html