SLIDE 1 Deployment automation for an AWS Serverless project: SAM vs CloudFormation vs Terraform vs ServerlessFramework
Bruno Amaro Almeida | 9 Sept 2019
Community Day 2019 Sponsors
@bruno_amaro
SLIDE 2 He Helsinki Ta Tampere St Stockholm Os Oslo Lo London Be Berlin Mu Munich
Nordic Roots, Global Mindset
PEOPLE
550+
NATIONALITIES
38
OFFICES
8
YoY GROWTH
30%
Family of Companies
eCommerce & Growth Hacking Artificial Intelligence & Machine Learning
St Stuttgart
SLIDE 3 B E R L I N · H E L S I N K I · L O N D O N · M U N I C H · O S L O · S T O C K H O L M · T A M P E R E
Who is this guy?
Pr Principal Ar Architect & Technology y Ad Advi visor @ Fu Futurice native, based in Cloud, DevOps, Security, Data Engineering & AI
@brunoamaroalmeida @bruno_amaro Reach out on:
SLIDE 4 AUTOMATE AND DEPLOY (…) provisions your resources in a safe, repeatable manner, allowing you to build and rebuild your infrastructure and applications, without having to perform manual actions or write custom scripts.
Why is Deployment Automation Important?
source: aws.amazon.com
REASONS FOR AUTOMATING INFRASTRUCTURE
- Repeatable re-deployable infrastructure
- Documented maintainable infrastructure
- Scalable solutions
- Huge Architectures
- Complex systems
source: google cloud platform
SLIDE 5 B E R L I N · H E L S I N K I · L O N D O N · M U N I C H · O S L O · S T O C K H O L M · T A M P E R E
[UNPOPULAR OPINION]: NOT EVERYTHING NEEDS TO BE AUTOMATED
Photo by Steve Johnson on Unsplash
SLIDE 6 B E R L I N · H E L S I N K I · L O N D O N · M U N I C H · O S L O · S T O C K H O L M · T A M P E R E
A ”real-world" Serverless App
Fr Front ntend nd
- 1 x Static Website:
- Displays different options
- Allows the visitor to select an option.
Ba Backend
- 1 x API
- Process the chosen option and stores the result.
SLIDE 7 B E R L I N · H E L S I N K I · L O N D O N · M U N I C H · O S L O · S T O C K H O L M · T A M P E R E
A Serverless App
Wh What is is yo your fa favo vorite Ge German ca car br brand nd? ?
Audi, Mercedes-Benz or BMW?
Visit hello.devopssquad.com today 💛
SLIDE 8 Architecture
@bruno_amaro
SLIDE 9 Athena & QuickSight for Results
@bruno_amaro
SLIDE 10
“
AWS AWS CloudFormation provides a common language for you to describe and provision all the infrastructure resources in your cloud environment. CloudFormation allows you to use a simple text file to model and provision, in an automated and secure manner, all the resources needed for your applications across all regions and accounts.
source: aws.amazon.com
SLIDE 11 (optional) Pa Parame meters
CloudFormation
Re Resources (optional) Ou Outputs
Other sections (optional): Tr Trans nsforms, , Ma Mappings, , Co Conditions, , et etc
SLIDE 12
“
The AWS Se Serverless Application Model extends AWS CloudFormation to provide a simplified way of defining the Amazon API Gateway APIs, AWS Lambda functions, and Amazon DynamoDB tables needed by your serverless application.”
source: aws.amazon.com
SLIDE 13 Serverless Application Model
AWS::IAM::Role AWS::Lambda::Function AWS::Lambda::Permission AWS::ApiGateway::RestApi AWS::ApiGateway::Resource AWS::ApiGateway::Method AWS::ApiGateway::Deployment AWS::ApiGateway::Stage AWS::ApiGateway::Method AWS::Serverless::Api (*) AWS::Serverless::Function AWS::ApiGateway::ApiKey AWS::ApiGateway::UsagePlan AWS::ApiGateway::UsagePlanKey AWS::ApiGateway::DomainName AWS::ApiGateway::BasePathMapping AWS::Route53::RecordSetGroup AWS::S3::Bucket AWS::S3::BucketPolicy
Cl CloudFormation SA SAM
@bruno_amaro
SLIDE 14 Serverless Application Model
- Zip the lambda dir & S3 upload
- Outputs a new template file
( packaged.yaml )
testing
- Allow publishing to public
repository
@bruno_amaro
SLIDE 15
“
Te Terraform is a tool for building, changing, and versioning infrastructure safely and efficiently. Terraform can manage existing and popular service providers as well as custom in- house solutions.”
source: terraform.io
SLIDE 16 Terraform
- Open Source project from Ha
Hashicorp
- Multi-Cloud support (AWS, Azure, GCP, etc)
- Multiple providers and services to be combined and composed
- Separation between planning and execution phase
- Module Registry
SLIDE 17 Terraform
Pl Plan In Init
SLIDE 18 Terraform
Ap Appl y (Optional) Ge Generate re resourc urce gr graph
@bruno_amaro
SLIDE 19 “
The Se Serverless Fr Fram amew ewor
k helps you build serverless apps with radically less overhead and cost. It provides a powerful, unified experience to develop, deploy, test, secure and monitor your serverless applications.
source: serverless.com
SLIDE 20 Serverless Framework
- Open Source project from Se
ServerlessFramework
- Basic Multi-Cloud support (AWS, Azure, GCP, etc)
- Focus on the core serverless components (e.g. API GW, Lambda, etc)
- Ability to include Cloud Formation to extend the functionality
SLIDE 21 Serverless Framework
@bruno_amaro
SLIDE 22 CloudFormation vs SAM vs Terraform vs ServerlessFramework
Pr Pro:
- AWS Native
- Fully supported by
AWS
- Free of charge
- JSON or YAML
Co Con:
¯\_( _(ツ)_ )_/¯
templates
at a good level CloudFormation Ser erver erles ess Appl pplica cation Mod
Terraform Pr Pro:
CloudFormation
- Ability to local debugging
and testing
- Easier packaging
- AWS SAM Repository
Co Con:
Resources ¯\_( _(ツ)_ )_/¯
- You still end up writting the
usual CF to workaround missing features Pr Pro
- Open Source project from Hashicorp
- Module Registry
- Multiple providers can be combined
- Multi-Cloud support (AWS, Azure, GCP, etc)
Co Con
- Not AWS Native and Support is paid
- Couple of workarounds here and there
¯\_( _(ツ)_ )_/¯
- Multi-Cloud support
- Resource Graphs
- Separate planning and execution phase
- Remote state files (chicken or the egg)
Serverless Framework Pr Pro
ServerlessFramework
- Easy to get up and running with
basic resources
- Basic Multi-Cloud support (AWS,
Azure, GCP, etc) Co Con
- Limited support (purely focused on
the traditional serverless resources) ¯\_( _(ツ)_ )_/¯
- Two separate languages (ie. CF)
- Agnostic infra tool ended up being a
JS project with 1000+ of frequently updating npm dependencies
@bruno_amaro
SLIDE 23 Thank you! Kiitos! Danke! Tack!
B E R L I N · H E L S I N K I · L O N D O N · M U N I C H · O S L O · S T O C K H O L M · T A M P E R E
Bruno Almeida
PRINCIPAL ARCHITECT & TECHNOLOGY ADVISOR
Cloud, Security, DevOps, Data Engineering & AI @brunoamaroalmeida @bruno_amaro Reach out on: