Deployment automation for an AWS Serverless project: SAM vs CloudFormation vs Terraform vs ServerlessFramework Bruno Amaro Almeida | 9 Sept 2019 @bruno_amaro Community Day 2019 Sponsors
FUTURE. CO-CREATED. Nordic Roots, Global Mindset PEOPLE NATIONALITIES 550+ 38 Ta Tampere Helsinki He Oslo Os St Stockholm OFFICES YoY GROWTH 8 30% Family of Companies Berlin Be Lo London Artificial Intelligence eCommerce & & Machine Learning Growth Hacking St Stuttgart Mu Munich
Who is this guy? Pr Principal Ar Architect & Technology y Ad Advi visor @ Fu Futurice native, based in Cloud, DevOps, Security, Data Engineering & AI Reach out on: @bruno_amaro 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 @brunoamaroalmeida
Why is Deployment Automation Important? 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 REASONS FOR AUTOMATING write custom scripts. INFRASTRUCTURE source: aws.amazon.com • Repeatable re-deployable infrastructure • Documented maintainable infrastructure • Scalable solutions • Huge Architectures • Complex systems source: google cloud platform
[UNPOPULAR OPINION]: NOT EVERYTHING NEEDS TO BE AUTOMATED 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 Photo by Steve Johnson on Unsplash
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. 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 💛 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
Architecture @bruno_amaro
Athena & QuickSight for Results @bruno_amaro
“ 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
CloudFormation (optional) Pa Parame meters Re Resources (optional) Ou Outputs Other sections (optional): Tr Trans nsforms, , Ma Mappings, , Co Conditions, , et etc
“ 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
Cl CloudFormation SAM SA Serverless Application Model AWS::IAM::Role AWS::Lambda::Function AWS::Lambda::Permission AWS::ApiGateway::RestApi AWS::Serverless::Api (*) AWS::ApiGateway:: Resource AWS:: Serverless ::Function AWS::ApiGateway::Method AWS::ApiGateway::Deployment AWS::ApiGateway::Stage AWS::ApiGateway::Method AWS::ApiGateway::ApiKey AWS::ApiGateway::UsagePlan AWS::ApiGateway::UsagePlanKey AWS::ApiGateway::DomainName AWS::ApiGateway::BasePathMapping AWS::Route53::RecordSetGroup AWS::S3::Bucket AWS::S3::BucketPolicy @bruno_amaro
Serverless Application Model • Local debugging and testing • Zip the lambda dir & S3 upload • Outputs a new template file ( packaged.yaml ) • Allow publishing to public repository @bruno_amaro
“ 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
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
Terraform In Init Pl Plan
Terraform (Optional) Ge Generate re resourc urce gr graph Ap Appl y @bruno_amaro
“ The Se Serverless Fr Fram amew ewor ork 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
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
Serverless Framework @bruno_amaro
CloudFormation vs SAM vs Terraform vs ServerlessFramework Terraform Serverless Framework CloudFormation Ser erver erles ess Appl pplica cation Mod odel Pro Pr Pro Pr Pro: Pr Pro: Pr • • Open Source project from Open Source project from Hashicorp • Extension of AWS • AWS Native ServerlessFramework CloudFormation • Module Registry • Fully supported by • Easy to get up and running with • Ability to local debugging AWS • Multiple providers can be combined basic resources and testing • Free of charge • Multi-Cloud support (AWS, Azure, GCP, etc) • Basic Multi-Cloud support (AWS, • Easier packaging Azure, GCP, etc) • JSON or YAML • AWS SAM Repository Con Co Con Co Con: Co • Not AWS Native and Support is paid Con : Co • Limited support (purely focused on • Hard to troubleshoot • Couple of workarounds here and there the traditional serverless • Only covers some AWS resources) Resources _( ツ )_ ¯\_( )_/¯ _( ツ )_ ¯\_( )_/¯ _( ツ )_ _( ツ )_ ¯\_( )_/¯ • ¯\_( )_/¯ Not so easy to write • Multi-Cloud support templates • • Two separate languages (ie. CF) You still end up writting the • Resource Graphs • usual CF to workaround Documentation is not • Agnostic infra tool ended up being a missing features at a good level • Separate planning and execution phase JS project with 1000+ of frequently updating npm dependencies • Remote state files (chicken or the egg) @bruno_amaro
Thank you! Kiitos! Danke! Bruno Almeida Tack! PRINCIPAL ARCHITECT & TECHNOLOGY ADVISOR Cloud, Security, DevOps, Data Engineering & AI Reach out on: @bruno_amaro @brunoamaroalmeida 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
Recommend
More recommend