Serverless Stacks

AWS CloudFormation

"AWS CloudFormation enables you to create and provision AWS infrastructure deployments predictably and repeatedly. It helps you leverage AWS products such as Amazon EC2, Amazon Elastic Block Store, Amazon SNS, Elastic Load Balancing, and Auto Scaling to build highly reliable, highly scalable, cost-effective applications in the cloud without worrying about creating and configuring the underlying AWS infrastructure. AWS CloudFormation enables you to use a template file to create and delete a collection of resources together as a single unit (a stack)." AWS Cloud Formation

AWS Serverless Application Model (SAM)

"The AWS Serverless Application Model (AWS SAM) is an open-source framework that enables you to build serverless applications on AWS. It provides you with a template specification to define your serverless application, and a command line interface (CLI) tool." AWS Serverless Application Model

AWS SAM is built on top of CloudFormation. You author a SAM template and submit it to the CloudFormation service which applies the "SAM Transformation Macro" to the submitted template to generate a cloud formation template. SAM templates may contain SAM specific resource specifications that simplify the specification of those resources normally required to leverage AWS ApiGateway resources and AWS Lambda resources. For instance, the AWS::Serverless::HttpApi resource is translated, by the translation macro, into an AWS::ApiGatewayV2::Api resource.

AWS Cognito

"Amazon Cognito handles user authentication and authorization for your web and mobile apps. With user pools, you can easily and securely add sign-up and sign-in functionality to your apps. With identity pools (federated identities), your apps can get temporary credentials that grant users access to specific AWS resources, whether the users are anonymous or are signed in." AWS Cognito

LazyStack makes extensive use of AWS Cognito. AWS Cognito is not part of AWS SAM but it does work seamlessly with SAM stacks.

AWS Lambda

With AWS Lambda, you can run code without provisioning or managing servers. You pay only for the compute time that you consume—there’s no charge when your code isn’t running. You can run code for virtually any type of application or backend service—all with zero administration. Just upload your code and Lambda takes care of everything required to run and scale your code with high availability. You can set up your code to automatically trigger from other AWS services or call it directly from any web or mobile app. AWS Lambda

The AWS SAM transformation macro translates AWS::Serverless::Function resources into AWS::Lambda::Function resources.

How hard can it be?

AWS SAM provides a huge shortcut to fielding application stacks. However, when you start adding in all the required plumbing for a commercial application, things get complicated. LazyStack's job is to keep things simple by adding in the required plumbing for a commercial application without requiring you to spend months digging through the AWS documentation or hiring an expensive AWS Consulting to write your templates.

LazyStack generates commercial grade AWS Serverless Application stacks from a OpenApi specification.

Can I extend or modify the Generated Stack?

The answer is "Absolutely!"

The LazyStack Generator reads directives from the LazyStack.yaml file to tailor the generated stacks. Using directives you can merge in separately authored SAM/CloudFormation templates, define AWS Resources directly in the LazyStack.yaml file, and add/override resource properties of previously defined resources (including default resources generated by LazyStack). We demonstrate adding a AWS DynamoDB resource to a generated stack in the LazyStack Tutorial Configure LazyStack step.

Is there any code "lock in" if I use LazyStack?

Code lock-in is evil. There are two types of code lock in often encountered in model driven development tools:

  • Proprietary library dependencies
  • Generated code is not maintainable

There are no proprietary dependencies in the stack or ClientSDK generated by LazyStack. We do provide support libraries, but these are all MIT Licensed open-source projects.

The C# code generated by LazyStack and NSwag follows accepted practices and is easily maintainable. In fact, the code generated is just plumbing - there is very little to maintain! Even if you choose to stop updating your stacks with LazyStack and manually edited your serverless.template file and projects instead, you would find it a mostly copy-paste-edit process.