Doing serverless on AWS with Terraform - serverless.tf
1.
2. Anton Babenko
AWS Community Hero / HashiCorp Ambassador / Certi
fi
ed Terraform fanatic since
2015.
Organiser of HashiCorp UG, AWS UG, DevOps Norway, DevOpsDays Oslo.
I 💚 open-source:
terraform-aws-modules
antonbabenko/terraform-aws-devops — links to most of my projects
antonbabenko/pre-commit-terraform — clean code, documentation, and more
serverless.tf — Doing serverless on AWS with Terraform
antonbabenko/terragrunt-reference-architecture — Terragrunt reference
architecture
www.terraform-best-practices.com
@antonbabenko — Twitter, GitHub, Linkedin
3. Subscribe here — bit.ly/terraform-youtube
Your weekly dose of Terraform with news, reviews, Q&A, interviews, and live-coding.
@antonbabenko
4. @antonbabenko
Collection of open-source Terraform AWS modules supported by the community with over 40
million provisions
(VPC, Autoscaling, RDS, Security Groups, ELB, ALB, Redshift, SNS, SQS, IAM, EKS, ECS,
TGW, S3 bucket, CloudFront, Lambda, API Gateway, AppSync…)
github.com/terraform-aws-modules
registry.terraform.io/modules/terraform-aws-modules
8. Available options
Use default for serverless — AWS SAM or Serverless Framework
Manage infrastructure — Terraform or AWS CloudFormation
Deployments — shell scripts, Make
fi
les, AWS CodeDeploy, AWS CLI
Periodically go through yak shaving and rabbit holes
@antonbabenko
9. Problems with existing solutions
Too many overlapping solutions
Accidental complexity
Overlap in infrastructure management is not uncommon (AWS
CloudFormation + Terraform)
@antonbabenko
10. Problems with such solutions
Alternative path
Too many overlapping solutions ("where does this belong to?"):
Application code = Python, JS, Go, …
Infrastructure code = Terraform
Accidental complexity:
Focus more on what is key — your application code
Avoid diving into internals of plugins to get your job done!
Overlap in infrastructure management is not uncommon (AWS CloudFormation / CDK vs Terraform):
Most likely, you prefer Terraform anyway :)
@antonbabenko
12. serverless.tf highlights
100% decoupled modules for building, packaging, and deploying
Use Terraform AWS Lambda module for all Lambda-related tasks —
https://github.com/terraform-aws-modules/terraform-aws-lambda/
Focus on writing the application logic, and use Terraform — for
everything else
Treat serverless applications & infrastructure as code all the time
"Simplifying serverless for all"
@antonbabenko
17. Integrations
Use any Terraform modules (eg, terraform-aws-modules)
No need to use Serverless Framework plugins or similar
@antonbabenko
18. CI/CD with serverless.tf
Split package building and deployments
Locally — "terraform init", "terraform plan", "terraform apply"
Use services like env0.com, Atlantis, Terraform Cloud to run your
Terraform pipeline
@antonbabenko