CloudFormation is a great AWS service to automate infrastructure, but working with large infrastructures is rarely managed in a single CF file. It’s very common to split resources in different template files and take advantage of CloudFormation stack nesting or ImportValue function calls. In fact, the Serverless Framework uses stack nesting to manage AWS resources.
On the other hand, the Serverless framework is awesome to keep things simple when talking about deployment and putting everything together.
If you have been working with CF a little bit before start using the Serverless framework, you may have (as I do) a library of components for CF that you use to compose larger infrastructures. You may work on projects that use CloudFormation directly and others using Serverless, but you would like to still use the same CF templates.
If that’s your case, you will (sadly) find out you can’t refer to local CF files in your resouces (AFAIK). For instance, if you have a CF component to manage SQS queues, you may want to do something like this in a Serverless project:
Resources: SQSQueue: Type: AWS::CloudFormation::Stack Properties: TemplateURL: ../aws-cf-templates/messaging/sqs.yml Parameters: QueueName: my-sqs-queue MessageRetentionPeriod: 14400 ReceiveMessageWaitTimeSeconds: 20 VisibilityTimeout: 3600 MaxReceiveCount: 2
However, that will break your sls deploy because CloudFormation can’t access to your local file …/aws-cf-templates/messaging/sqs.yml. Luckily, AWS solved that problem using aws-cli package feature. AFAIK this is not integrated within Serverless framework. Is there anybody else interested in such a feature?
I have written a small Serverless plugin to do so, however it’s still a small PoC. I would be happy to keep working on it if there is some community interest. It depends on aws-cli in order to use built-in package feature.