I'm trying to understand how Serverless works. I've gone through a lot of their docs / tutorials, however when I get to the part where I want to build something specific, like an RDS instance, I have no frame of reference for what the MVP will look like.
I found this Q/A post that showed what looked to be the basics for standing up an RDS instance. I swapped out the region for a more local one, then tried it out:
service: sandbox
app: sandbox
org: # omitting
provider:
name: aws
runtime: nodejs12.x
resources:
Resources:
Vpc:
Type: AWS:EC2::VPC
Properties:
CidrBlock: 10.0.0.0/16
InstanceTenancy: default
PublicSubnet:
Type: AWS::EC2::Subnet
Properties:
CidrBlock: 10.0.0.0/18
VpcId:
Ref: Vpc
PrivateSubnet1:
Type: AWS::EC2::Subnet
Properties:
AvailabilityZone: ca-central-1a
CidrBlock: 10.0.64.0/18
VpcId:
Ref: Vpc
PrivateSubnet2:
Type: AWS::EC2::Subnet
Properties:
AvailabilityZone: ca-central-1b
CidrBlock: 10.0.128.0/18
VpcId:
Ref: Vpc
Database:
Type: AWS::RDS:DBInstance
Properties:
Engine: aurora
EngineVersion: 5.6.10a
DBInstanceClass: db.r5.large
DBName: MyDatabase
MasterUsername: test
MasterUserPassword: # ommitting
DBSubnetGroupName:
Ref: DBSubnetGroup
VPCSecurityGroups:
- Ref: DatabaseVpcSecurityGroup
DBSubnetGroup:
Type: "AWS::RDS::DBSubnetGroup"
Properties:
DBSubnetGroupName: PrivateDbSubnet
DBSubnetGroupDescription: PrivateDbSubnet
SubnetIds:
- Ref: PrivateSubnet1
- Ref: PrivateSubnet2
DatabaseVpcSecurityGroup:
Type: "AWS::EC2::SecurityGroup"
Properties:
GroupName: DBSecurityGroup
GroupDescription: Allow local access
SecurityGroupIngress:
- CidrIp: 10.0.0.0/16
IpProtocol: tcp
FromPort: 3306
ToPort: 3306
VpcId:
Ref: Vpc
When I attempt to deploy this with Serverless, I get the following error:
The CloudFormation template is invalid: Template format error: Unrecognized resource types: [AWS:EC2::VPC, AWS::RDS:DBInstance]
I can see that these resources exist on AWS:
So... what does this error mean? What Am I doing wrong?
You have typos in your resource type. In both cases you have a single colon (:) where you should have a double colon (::)