You should be able to create EC2 instances via resources. Here’s an example below:
resources: # CloudFormation template syntax
KeyName: yourSshKeyName # This needs to be created manually. CloudFormation does not allow it
InstanceType: t2.micro // pick whatever size you want
SubnetId: // your subnetId
- // your security group IDs
You can see the full documentation for all the options available to you here:
Scroll down to the YAML section.
Hope this helps
Edit: Further, this is how you would define any resource that isn’t available to be created with the Serverless framework itself. Resources can be any AWS resource through raw Cloudformation.