Hi,
I’m analyzing the possibility to use Amazon RDS (mySQL engine) in combination with Lambda and APIGateway but I’m not experienced neither in automated mySQL instances deployment nor RDS service and I’m a bit worried because I don’t want too much time by understand how to automate the resource creation and to guarantee database scalability.
(In my last project I used the serverless framework to deploy APIG-Lambda endpoints and it was super easy)
Here are my doubts (I want to avoid the creation of amazon resources manually in the AWS console):
Is there a way to automate the database creation by using the serverless framework?
Any advice on how to deal with VPC? (I also need IPv6 support)
**What are the best practices to deploy database scripts when using RDS?
thank you in advance
Yes. You will need to define the cloudformation in the resources
block of serverless.yml with the resources you need with your service. In this case it’s cloudformation for a RDS instance.
Checkout Amazon RDS template snippets - AWS CloudFormation for more info on that cloudformation yaml to place in the resources
section
1 Like
You also ask about VPC - yes, you can do that in resources/CloudFormation template, however, there’s potentially a lot of stuff to add (security groups, etc.), plus I have had issues before when locating the lambda in the VPC and having it just hang when trying to call AWS SDK methods (not in a current project, so a) i don’t remember all the details, and b) it might have changed by now). My advice would be to use the default VPC for your RDS to get started, then once that works try creating another VPC, and stuff.
You also mention “deploy database scripts” – are you asking about database initialization or migrations? Unfortunately, that’s outside the scope of what I know that SLS can do right now (although, in fairness, there’s been LOTS of stuff added recently).
HTH, Mark
1 Like