Can serverless be used to to create RDS instance?

Question:

Currently we are using Serverless framework to update our dev/test environments, and manage our environments manually. Eg. each time we create a new environment, we manually create Elastic Beanstalk application & RDS instance. Is it possible to automate all this using serverless script? or cloudformation?

Answer:

With CloudFormation that’s pretty straight forward. All you need is to define an AWS::RDS::DBInstance. AWS also provides some example templates for that: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/sample-templates-services-us-east-1.html#w2ab2c23c42c13c27

As you can include CloudFormation resources in Serverless, you can add that directly to your serverless.yml so it gets deployed by Serverless without the need to use a separate CloudFormation deployment: https://serverless.com/framework/docs/providers/aws/guide/resources/

More complete example of all available options for RDS (including Aurora):
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html

Leave a Reply