sept19 awsgermany deployment automation for an aws ... automation f… · amazon api gateway apis,...
TRANSCRIPT
Deployment automation for an AWS Serverless project: SAM vs CloudFormation vs Terraform vs ServerlessFrameworkBruno Amaro Almeida | 9 Sept 2019
Community Day 2019 Sponsors
@bruno_amaro
Helsinki
Tampere
StockholmOslo
LondonBerlin
Munich
Nordic Roots,Global Mindset
FU T U R E . C O - C R E A T E D .
P E OP LE
550+NATIONALITIE S
38OFFICE S
8YoY GROW TH
30%Family of Companies
eCommerce &Growth Hacking
Artificial Intelligence& Machine Learning
Stuttgart
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?Principal Architect & Technology Advisor @ Futurice
native, based in
Cloud, DevOps, Security, Data Engineering & AI
@brunoamaroalmeida
@bruno_amaro
Reach out on:
! "
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 systemssource: google cloud platform
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
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 AppFrontend
• 1 x Static Website: • Displays different options• Allows the visitor to select an option.
Backend
• 1 x API• Process the chosen option and stores the result.
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
What is your favoriteGerman car brand?
Audi, Mercedes-Benz or BMW?
Visit hello.devopssquad.com today 💚
Architecture
@bruno_amaro
Athena & QuickSight for Results
@bruno_amaro
“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
(optional) Parameters
CloudFormation
Resources
(optional) OutputsOther sections (optional): Transforms, Mappings, Conditions, etc
“The AWS 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
Serverless Application ModelAWS::IAM::RoleAWS::Lambda::FunctionAWS::Lambda::PermissionAWS::ApiGateway::RestApiAWS::ApiGateway::ResourceAWS::ApiGateway::MethodAWS::ApiGateway::DeploymentAWS::ApiGateway::StageAWS::ApiGateway::Method
AWS::Serverless::Api (*)AWS::Serverless::Function
AWS::ApiGateway::ApiKeyAWS::ApiGateway::UsagePlanAWS::ApiGateway::UsagePlanKeyAWS::ApiGateway::DomainNameAWS::ApiGateway::BasePathMappingAWS::Route53::RecordSetGroupAWS::S3::BucketAWS::S3::BucketPolicy
CloudFormation SAM
@bruno_amaro
Serverless Application Model
• Zip the lambda dir & S3 upload
• Outputs a new template file ( packaged.yaml )
• Local debugging and testing
• Allow publishing to public repository
@bruno_amaro
“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
Terraform• Open Source project from 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
Terraform
Plan
Init
Terraform
Apply
(Optional) Generate resource graph
@bruno_amaro
“The Serverless Framework helps you build serverless appswith radically less overhead and cost. It provides a powerful, unified experience to develop, deploy, test, secure and monitor your serverless applications.
source: serverless.com
Serverless Framework• Open Source project from 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
Serverless Framework
@bruno_amaro
CloudFormation vs SAM vs Terraform vs ServerlessFramework
Pro:
• AWS Native
• Fully supported by AWS
• Free of charge
• JSON or YAML
Con:
• Hard to troubleshoot
¯\_(ツ)_/¯
• Not so easy to write templates
• Documentation is not at a good level
CloudFormation Serverless Application Model Terraform
Pro:
• Extension of AWS CloudFormation
• Ability to local debuggingand testing
• Easier packaging
• AWS SAM Repository
Con:
• Only covers some AWS Resources
¯\_(ツ)_/¯
• You still end up writting theusual CF to workaroundmissing features
Pro
• Open Source project from Hashicorp
• Module Registry
• Multiple providers can be combined
• Multi-Cloud support (AWS, Azure, GCP, etc)
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 FrameworkPro
• Open Source project fromServerlessFramework
• Easy to get up and running with basic resources
• Basic Multi-Cloud support (AWS, Azure, GCP, etc)
Con
• Limited support (purely focused on the traditional serverlessresources)
¯\_(ツ)_/¯
• Two separate languages (ie. CF)
• Agnostic infra tool ended up being a JS project with 1000+ of frequentlyupdating npm dependencies
@bruno_amaro
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 AlmeidaPRINCIPAL ARCHITECT & TECHNOLOGY ADVISOR
Cloud, Security, DevOps, Data
Engineering & AI
@brunoamaroalmeida
@bruno_amaro
Reach out on: